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 | 31 | 3.times do |
32 | 32 | env.boxes << Box.new |
33 | 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 | 39 | end |
36 | 40 | |
37 | 41 | # One Environment can be reached by many domains |
... | ... | @@ -142,6 +146,16 @@ class Environment < ActiveRecord::Base |
142 | 146 | self.settings['organization_approval_method'] = actual_value |
143 | 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 | 160 | # Validations |
147 | 161 | # ################################################# | ... | ... |
test/unit/environment_test.rb
... | ... | @@ -240,4 +240,11 @@ class EnvironmentTest < Test::Unit::TestCase |
240 | 240 | assert_equivalent [doc1,doc2,doc3], environment.recent_documents(3) |
241 | 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 | 250 | end | ... | ... |