Commit 206492735f7dcaed88fde1bb1b2a30947a0ff68a
1 parent
1b685486
Exists in
master
and in
29 other branches
ActionItem501: redefining default blocks of enterprise and person
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2195 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
7 changed files
with
13 additions
and
24 deletions
Show diff stats
app/models/enterprise.rb
@@ -61,8 +61,8 @@ class Enterprise < Organization | @@ -61,8 +61,8 @@ class Enterprise < Organization | ||
61 | def default_set_of_blocks | 61 | def default_set_of_blocks |
62 | [ | 62 | [ |
63 | [MainBlock], | 63 | [MainBlock], |
64 | - [ProfileInfoBlock, ProductsBlock, RecentDocumentsBlock], | ||
65 | - [MembersBlock, TagsBlock] | 64 | + [ProfileInfoBlock, MembersBlock], |
65 | + [ProductsBlock, RecentDocumentsBlock] | ||
66 | ] | 66 | ] |
67 | end | 67 | end |
68 | 68 |
app/models/person.rb
@@ -73,8 +73,8 @@ class Person < Profile | @@ -73,8 +73,8 @@ class Person < Profile | ||
73 | def default_set_of_blocks | 73 | def default_set_of_blocks |
74 | [ | 74 | [ |
75 | [MainBlock], | 75 | [MainBlock], |
76 | - [ProfileInfoBlock, RecentDocumentsBlock], | ||
77 | - [TagsBlock, FriendsBlock, CommunitiesBlock, EnterprisesBlock] | 76 | + [ProfileInfoBlock, RecentDocumentsBlock, TagsBlock], |
77 | + [FriendsBlock, EnterprisesBlock, CommunitiesBlock] | ||
78 | ] | 78 | ] |
79 | end | 79 | end |
80 | 80 |
app/models/profile.rb
@@ -171,7 +171,7 @@ class Profile < ActiveRecord::Base | @@ -171,7 +171,7 @@ class Profile < ActiveRecord::Base | ||
171 | 171 | ||
172 | # registar callback for creating boxes after the object is created. | 172 | # registar callback for creating boxes after the object is created. |
173 | after_create :create_default_set_of_boxes | 173 | after_create :create_default_set_of_boxes |
174 | - | 174 | + |
175 | # creates the initial set of boxes when the profile is created. Can be | 175 | # creates the initial set of boxes when the profile is created. Can be |
176 | # overriden for each subclass to create a custom set of boxes for its | 176 | # overriden for each subclass to create a custom set of boxes for its |
177 | # instances. | 177 | # instances. |
script/anhetegua
@@ -201,17 +201,6 @@ colivre.products.build(:name => 'capacitação em software livre', :product_cate | @@ -201,17 +201,6 @@ colivre.products.build(:name => 'capacitação em software livre', :product_cate | ||
201 | colivre.products.build(:name => 'arte digital', :product_category => arte_digital).save! | 201 | colivre.products.build(:name => 'arte digital', :product_category => arte_digital).save! |
202 | colivre.products.build(:name => 'instalação e manutenção de servidores', :product_category => admin_de_sistemas).save! | 202 | colivre.products.build(:name => 'instalação e manutenção de servidores', :product_category => admin_de_sistemas).save! |
203 | 203 | ||
204 | -colivre_hp = TinyMceArticle.new(:name => 'Colivre - Cooperativa de Tecnologias Livres', :body => '<p>A Colivre, Cooperativa de Tecnologias Livres, é uma organização baiana que presta serviços de instalação de redes, segurança, capacitação, migração e desenvolvimento de novas soluções, trabalhando exclusivamente com Tecnologias Livres. Para tanto, contamos com uma equipe formada por desenvolvedores/as de software, webdesigners e gestoras/es com vasta experiência na área.</p>', :tag_list => 'software livre, colivre, cooperativa' ) | ||
205 | -colivre_hp.profile = colivre | ||
206 | -colivre_hp.save! | ||
207 | -colivre.home_page = colivre_hp | ||
208 | -colivre.save! | ||
209 | - | ||
210 | -empa_hp = TinyMceArticle.new(:name => 'Empreendimento A - um empreendimento genérico', :body => '<p>Esse é um empreendimento cadastrado como exemplo no sitema</p>', :tag_list => 'cooperativa, teste') | ||
211 | -empa_hp.profile = empa | ||
212 | -empa.home_page = empa_hp | ||
213 | -empa.save! | ||
214 | - | ||
215 | # creating sample communities | 204 | # creating sample communities |
216 | comm1 = Community.create!(:name => 'Outra Economia é Possível') | 205 | comm1 = Community.create!(:name => 'Outra Economia é Possível') |
217 | comm1.affiliate(ze, owner_role) | 206 | comm1.affiliate(ze, owner_role) |
test/functional/content_viewer_controller_test.rb
@@ -129,7 +129,8 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -129,7 +129,8 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
129 | 129 | ||
130 | end | 130 | end |
131 | 131 | ||
132 | - should "not be able to remove other people's comments" do | 132 | + should "not be able to remove other people's comments if not moderator or admin" do |
133 | + create_user('normaluser') | ||
133 | profile = create_user('testuser').person | 134 | profile = create_user('testuser').person |
134 | article = profile.articles.build(:name => 'test') | 135 | article = profile.articles.build(:name => 'test') |
135 | article.save! | 136 | article.save! |
@@ -138,7 +139,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -138,7 +139,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
138 | comment = article.comments.build(:author => commenter, :title => 'a comment', :body => 'lalala') | 139 | comment = article.comments.build(:author => commenter, :title => 'a comment', :body => 'lalala') |
139 | comment.save! | 140 | comment.save! |
140 | 141 | ||
141 | - login_as 'ze' # ze cannot remove other people's comments | 142 | + login_as 'normaluser' # normaluser cannot remove other people's comments |
142 | assert_no_difference Comment, :count do | 143 | assert_no_difference Comment, :count do |
143 | post :view_page, :profile => profile.identifier, :page => [ 'test' ], :remove_comment => comment.id | 144 | post :view_page, :profile => profile.identifier, :page => [ 'test' ], :remove_comment => comment.id |
144 | assert_response :redirect | 145 | assert_response :redirect |
test/unit/enterprise_test.rb
@@ -68,13 +68,12 @@ class EnterpriseTest < Test::Unit::TestCase | @@ -68,13 +68,12 @@ class EnterpriseTest < Test::Unit::TestCase | ||
68 | assert e.boxes[0].blocks.map(&:class).include?(MainBlock), 'enterprise must have a MainBlock upon creation' | 68 | assert e.boxes[0].blocks.map(&:class).include?(MainBlock), 'enterprise must have a MainBlock upon creation' |
69 | 69 | ||
70 | assert e.boxes[1].blocks.map(&:class).include?(ProfileInfoBlock), 'enterprise must have a ProfileInfoBlock upon creation' | 70 | assert e.boxes[1].blocks.map(&:class).include?(ProfileInfoBlock), 'enterprise must have a ProfileInfoBlock upon creation' |
71 | - assert e.boxes[1].blocks.map(&:class).include?(ProductsBlock), 'enterprise must have a ProductsBlock upon creation' | ||
72 | - assert e.boxes[1].blocks.map(&:class).include?(RecentDocumentsBlock), 'enterprise must have a RecentDocumentsBlock upon creation' | 71 | + assert e.boxes[1].blocks.map(&:class).include?(MembersBlock), 'enterprise must have a MembersBlock upon creation' |
73 | 72 | ||
74 | - assert e.boxes[2].blocks.map(&:class).include?(MembersBlock), 'enterprise must have a MembersBlock upon creation' | ||
75 | - assert e.boxes[2].blocks.map(&:class).include?(TagsBlock), 'enterprise must have a TagsBlock upon creation' | 73 | + assert e.boxes[2].blocks.map(&:class).include?(RecentDocumentsBlock), 'enterprise must have a RecentDocumentsBlock upon creation' |
74 | + assert e.boxes[2].blocks.map(&:class).include?(ProductsBlock), 'enterprise must have a ProductsBlock upon creation' | ||
76 | 75 | ||
77 | - assert_equal 6, e.blocks.size | 76 | + assert_equal 5, e.blocks.size |
78 | end | 77 | end |
79 | 78 | ||
80 | should 'be found in search for its product categories' do | 79 | should 'be found in search for its product categories' do |
test/unit/person_test.rb
@@ -138,8 +138,8 @@ class PersonTest < Test::Unit::TestCase | @@ -138,8 +138,8 @@ class PersonTest < Test::Unit::TestCase | ||
138 | 138 | ||
139 | assert p.boxes[1].blocks.map(&:class).include?(ProfileInfoBlock), 'person must have a ProfileInfoBlock upon creation' | 139 | assert p.boxes[1].blocks.map(&:class).include?(ProfileInfoBlock), 'person must have a ProfileInfoBlock upon creation' |
140 | assert p.boxes[1].blocks.map(&:class).include?(RecentDocumentsBlock), 'person must have a RecentDocumentsBlock upon creation' | 140 | assert p.boxes[1].blocks.map(&:class).include?(RecentDocumentsBlock), 'person must have a RecentDocumentsBlock upon creation' |
141 | + assert p.boxes[1].blocks.map(&:class).include?(TagsBlock), 'person must have a Tags Block upon creation' | ||
141 | 142 | ||
142 | - assert p.boxes[2].blocks.map(&:class).include?(TagsBlock), 'person must have a Tags Block upon creation' | ||
143 | assert p.boxes[2].blocks.map(&:class).include?(CommunitiesBlock), 'person must have a CommunitiesBlock upon creation' | 143 | assert p.boxes[2].blocks.map(&:class).include?(CommunitiesBlock), 'person must have a CommunitiesBlock upon creation' |
144 | assert p.boxes[2].blocks.map(&:class).include?(EnterprisesBlock), 'person must have a EnterprisesBlock upon creation' | 144 | assert p.boxes[2].blocks.map(&:class).include?(EnterprisesBlock), 'person must have a EnterprisesBlock upon creation' |
145 | assert p.boxes[2].blocks.map(&:class).include?(FriendsBlock), 'person must have a FriendsBlock upon creation' | 145 | assert p.boxes[2].blocks.map(&:class).include?(FriendsBlock), 'person must have a FriendsBlock upon creation' |