Commit c09bb60a64040c0674fd94b50bda96523aeaf7e6
1 parent
a1383bac
Exists in
master
and in
28 other branches
ActionItem153: adding description attribute to Environment class
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1294 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
22 additions
and
1 deletions
Show diff stats
app/models/environment.rb
@@ -31,7 +31,11 @@ class Environment < ActiveRecord::Base | @@ -31,7 +31,11 @@ class Environment < ActiveRecord::Base | ||
31 | 3.times do | 31 | 3.times do |
32 | env.boxes << Box.new | 32 | env.boxes << Box.new |
33 | end | 33 | end |
34 | - env.boxes.first.blocks << MainBlock.new | 34 | + env.boxes[0].blocks << MainBlock.new |
35 | + | ||
36 | + env.boxes[1].blocks << EnvironmentStatisticsBlock.new | ||
37 | + env.boxes[1].blocks << RecentDocumentsBlock.new | ||
38 | + | ||
35 | end | 39 | end |
36 | 40 | ||
37 | # One Environment can be reached by many domains | 41 | # One Environment can be reached by many domains |
@@ -142,6 +146,16 @@ class Environment < ActiveRecord::Base | @@ -142,6 +146,16 @@ class Environment < ActiveRecord::Base | ||
142 | self.settings['organization_approval_method'] = actual_value | 146 | self.settings['organization_approval_method'] = actual_value |
143 | end | 147 | end |
144 | 148 | ||
149 | + # the description of the environment. Normally used in the homepage. | ||
150 | + def description | ||
151 | + self.settings[:description] | ||
152 | + end | ||
153 | + | ||
154 | + # sets the #description of the environment | ||
155 | + def description=(value) | ||
156 | + self.settings[:description] = value | ||
157 | + end | ||
158 | + | ||
145 | # ################################################# | 159 | # ################################################# |
146 | # Validations | 160 | # Validations |
147 | # ################################################# | 161 | # ################################################# |
test/unit/environment_test.rb
@@ -240,4 +240,11 @@ class EnvironmentTest < Test::Unit::TestCase | @@ -240,4 +240,11 @@ class EnvironmentTest < Test::Unit::TestCase | ||
240 | assert_equivalent [doc1,doc2,doc3], environment.recent_documents(3) | 240 | assert_equivalent [doc1,doc2,doc3], environment.recent_documents(3) |
241 | end | 241 | end |
242 | 242 | ||
243 | + should 'have a description attribute' do | ||
244 | + env = Environment.new | ||
245 | + | ||
246 | + env.description = 'my fine environment' | ||
247 | + assert_equal 'my fine environment', env.description | ||
248 | + end | ||
249 | + | ||
243 | end | 250 | end |