Commit 5a62852239c65f19fd34e0f390cc7226ad8e26bf
Exists in
staging
and in
1 other branch
Merge branch 'master' into staging
Showing
17 changed files
with
252 additions
and
86 deletions
Show diff stats
DEVELOPMENT.md
... | ... | @@ -11,6 +11,22 @@ |
11 | 11 | Noosfero version and/or the maintainance work of an existing Noosfero stable |
12 | 12 | branch. See MAINTAINANCE.md for details on the maintaince policy. |
13 | 13 | |
14 | +## Current Commiters | |
15 | + | |
16 | +* Antonio Terceiro (@terceiro) | |
17 | +* Bráulio Bhavamitra (@brauliobo) | |
18 | +* Daniela Feitosa (@danielafeitosa) | |
19 | +* Joenio Costa (@joenio) | |
20 | +* Larissa Reis (@larissa) | |
21 | +* Leandro Nunes (@leandronunes) | |
22 | +* Marcos Ronaldo (@marcosronaldo) | |
23 | +* Rodrigo Souto (@diguliu) | |
24 | +* Victor Costa (@vfcosta) | |
25 | + | |
26 | +## Current Release Manager | |
27 | + | |
28 | +* Rodrigo Souto (@diguliu) | |
29 | + | |
14 | 30 | ## Development process |
15 | 31 | |
16 | 32 | * Every new feature or non-trivial bugfix should be reviewed by at least one | ... | ... |
app/helpers/boxes_helper.rb
... | ... | @@ -88,7 +88,7 @@ module BoxesHelper |
88 | 88 | end |
89 | 89 | |
90 | 90 | def render_block block, prefix = nil, klass = block.class |
91 | - template_name = klass.name.underscore.sub '_block', '' | |
91 | + template_name = klass.name.demodulize.underscore.sub '_block', '' | |
92 | 92 | begin |
93 | 93 | render template: "blocks/#{prefix}#{template_name}", locals: { block: block } |
94 | 94 | rescue ActionView::MissingTemplate | ... | ... |
app/models/thumbnail.rb
... | ... | @@ -5,7 +5,7 @@ class Thumbnail < ActiveRecord::Base |
5 | 5 | attr_accessible :content_type, :filename, :thumbnail_resize_options, :thumbnail, :parent_id |
6 | 6 | |
7 | 7 | has_attachment :storage => :file_system, |
8 | - :content_type => :image, :max_size => 5.megabytes, processor: 'Rmagick' | |
8 | + :content_type => :image, :max_size => UploadedFile.max_size, processor: 'Rmagick' | |
9 | 9 | validates_as_attachment |
10 | 10 | |
11 | 11 | sanitize_filename | ... | ... |
lib/noosfero/plugin.rb
... | ... | @@ -233,7 +233,7 @@ class Noosfero::Plugin |
233 | 233 | type = type.map do |x| |
234 | 234 | x.is_a?(String) ? x.capitalize.constantize : x |
235 | 235 | end |
236 | - raise "This is not a valid type" if !type.empty? && ![Person, Community, Enterprise, Environment].detect{|m| type.include?(m)} | |
236 | + raise "This is not a valid type" if !type.empty? && (type.any?{|t| !(t < Profile) && t != Environment }) | |
237 | 237 | |
238 | 238 | position = options[:position] |
239 | 239 | position = position.is_a?(Array) ? position : [position].compact | ... | ... |
plugins/community_block/lib/community_block.rb
... | ... | @@ -7,13 +7,4 @@ class CommunityBlock < Block |
7 | 7 | def help |
8 | 8 | _("Help for Community Description Block.") |
9 | 9 | end |
10 | - | |
11 | - def content(arg={}) | |
12 | - block = self | |
13 | - | |
14 | - proc do | |
15 | - render :file => 'community_block', :locals => { :block => block } | |
16 | - end | |
17 | - end | |
18 | - | |
19 | 10 | end | ... | ... |
plugins/community_block/test/unit/commmunity_block_test.rb
... | ... | @@ -1,11 +0,0 @@ |
1 | -require_relative '../test_helper' | |
2 | - | |
3 | -class CommunityBlockTest < ActiveSupport::TestCase | |
4 | - | |
5 | - should "display community block" do | |
6 | - block = CommunityBlock.new | |
7 | - self.expects(:render).with(:file => 'community_block', :locals => { :block => block }) | |
8 | - instance_eval(& block.content) | |
9 | - end | |
10 | - | |
11 | -end |
... | ... | @@ -0,0 +1,52 @@ |
1 | +<div class="community-block"> | |
2 | + <div class="community-block-logo"> | |
3 | + <%= link_to profile_image(profile, :big), profile.url %> | |
4 | + </div> | |
5 | + <div class="community-block-info"> | |
6 | + <div class="community-block-title"> | |
7 | + | |
8 | + <% | |
9 | + links = [] | |
10 | + | |
11 | + if logged_in? | |
12 | + | |
13 | + if profile.enable_contact? | |
14 | + links.push(c_('Send an e-mail') => {:href => url_for({:controller => 'contact', :action => 'new', :profile => profile.identifier})}) | |
15 | + end | |
16 | + | |
17 | + links.push(c_('Report abuse') => {:href => url_for({:controller => 'profile', :action => 'report_abuse', :profile => profile.identifier})}) | |
18 | + | |
19 | + if !user.nil? && user.has_permission?('edit_profile', profile) | |
20 | + links.push(c_('Control panel') => {:href => url_for({:controller => 'profile_editor', :profile => profile.identifier})}) | |
21 | + end %> | |
22 | + | |
23 | + <%= link_to( | |
24 | + content_tag('span','',:class => 'community-block-button icon-arrow'), | |
25 | + '#', | |
26 | + :onclick => "toggleSubmenu(this,'',#{CGI::escapeHTML(links.to_json)}); return false;", | |
27 | + :class => 'simplemenu-trigger') %> | |
28 | + | |
29 | + <% end %> | |
30 | + | |
31 | + <% if logged_in? %> | |
32 | + <% if profile.members.include?(user) || profile.already_request_membership?(user) %> | |
33 | + <%= link_to( | |
34 | + content_tag('span', '', :class => 'community-block-button icon-remove'), | |
35 | + profile.leave_url, :class => 'join-community') %> | |
36 | + <% else %> | |
37 | + <%= link_to( | |
38 | + content_tag('span', '', :class => 'community-block-button icon-add'), | |
39 | + profile.join_url, :class => 'join-community') %> | |
40 | + <% end %> | |
41 | + <% else %> | |
42 | + <%= link_to( | |
43 | + content_tag('span', '', :class => 'community-block-button icon-add'), | |
44 | + profile.join_not_logged_url) %> | |
45 | + <% end %> | |
46 | + | |
47 | + <h1><%=profile.name%></h1> | |
48 | + </div> | |
49 | + <div class="community-block-description"><%= profile.description %></div> | |
50 | + </div> | |
51 | + <div style="clear:both"></div> | |
52 | +</div> | ... | ... |
plugins/community_block/views/community_block.html.erb
... | ... | @@ -1,52 +0,0 @@ |
1 | -<div class="community-block"> | |
2 | - <div class="community-block-logo"> | |
3 | - <%= link_to profile_image(profile, :big), profile.url %> | |
4 | - </div> | |
5 | - <div class="community-block-info"> | |
6 | - <div class="community-block-title"> | |
7 | - | |
8 | - <% | |
9 | - links = [] | |
10 | - | |
11 | - if logged_in? | |
12 | - | |
13 | - if profile.enable_contact? | |
14 | - links.push(c_('Send an e-mail') => {:href => url_for({:controller => 'contact', :action => 'new', :profile => profile.identifier})}) | |
15 | - end | |
16 | - | |
17 | - links.push(c_('Report abuse') => {:href => url_for({:controller => 'profile', :action => 'report_abuse', :profile => profile.identifier})}) | |
18 | - | |
19 | - if !user.nil? && user.has_permission?('edit_profile', profile) | |
20 | - links.push(c_('Control panel') => {:href => url_for({:controller => 'profile_editor', :profile => profile.identifier})}) | |
21 | - end %> | |
22 | - | |
23 | - <%= link_to( | |
24 | - content_tag('span','',:class => 'community-block-button icon-arrow'), | |
25 | - '#', | |
26 | - :onclick => "toggleSubmenu(this,'',#{CGI::escapeHTML(links.to_json)}); return false;", | |
27 | - :class => 'simplemenu-trigger') %> | |
28 | - | |
29 | - <% end %> | |
30 | - | |
31 | - <% if logged_in? %> | |
32 | - <% if profile.members.include?(user) || profile.already_request_membership?(user) %> | |
33 | - <%= link_to( | |
34 | - content_tag('span', '', :class => 'community-block-button icon-remove'), | |
35 | - profile.leave_url, :class => 'join-community') %> | |
36 | - <% else %> | |
37 | - <%= link_to( | |
38 | - content_tag('span', '', :class => 'community-block-button icon-add'), | |
39 | - profile.join_url, :class => 'join-community') %> | |
40 | - <% end %> | |
41 | - <% else %> | |
42 | - <%= link_to( | |
43 | - content_tag('span', '', :class => 'community-block-button icon-add'), | |
44 | - profile.join_not_logged_url) %> | |
45 | - <% end %> | |
46 | - | |
47 | - <h1><%=profile.name%></h1> | |
48 | - </div> | |
49 | - <div class="community-block-description"><%= profile.description %></div> | |
50 | - </div> | |
51 | - <div style="clear:both"></div> | |
52 | -</div> |
plugins/container_block/lib/container_block_plugin/container_block.rb
... | ... | @@ -66,13 +66,6 @@ class ContainerBlockPlugin::ContainerBlock < Block |
66 | 66 | children_settings[child_id][:width] if children_settings[child_id] |
67 | 67 | end |
68 | 68 | |
69 | - def content(args={}) | |
70 | - block = self | |
71 | - proc do | |
72 | - render :file => 'blocks/container', :locals => {:block => block} | |
73 | - end | |
74 | - end | |
75 | - | |
76 | 69 | def copy_from_with_container(block) |
77 | 70 | copy_from_without_container(block) |
78 | 71 | children_settings = block.children_settings | ... | ... |
plugins/oauth_client/README.md
... | ... | @@ -33,6 +33,14 @@ Facebook |
33 | 33 | |
34 | 34 | [Create Facebook application](https://developers.facebook.com/docs/facebook-login/v2.1) |
35 | 35 | |
36 | +Callback | |
37 | +======== | |
38 | + | |
39 | +This is the callback path that you need to use in your app configuration: | |
40 | + | |
41 | +/plugin/oauth_client/public/callback | |
42 | + | |
43 | + | |
36 | 44 | Varnish Settings |
37 | 45 | ================ |
38 | 46 | If varnish has been used in your stack, you've to bypass the cache for signup page and prevent cookies to be removed when calling the oauth_client plugin callback. E.g.: | ... | ... |
plugins/oauth_client/models/oauth_client_plugin/provider.rb
... | ... | @@ -11,7 +11,7 @@ class OauthClientPlugin::Provider < ActiveRecord::Base |
11 | 11 | settings_items :client_options, type: Hash |
12 | 12 | |
13 | 13 | attr_accessible :name, :strategy, :enabled, :site, :image_builder, |
14 | - :environment, :environment_id, | |
14 | + :environment, :environment_id, :options, | |
15 | 15 | :client_id, :client_secret, :client_options |
16 | 16 | |
17 | 17 | scope :enabled, -> { where enabled: true } | ... | ... |
plugins/oauth_client/views/oauth_client_plugin_admin/edit.html.erb
1 | 1 | <h1><%= _('Oauth Client Settings') %></h1> |
2 | 2 | <h3><%= _('Edit Provider') %></h3> |
3 | 3 | |
4 | -<%= form_for @provider, :url => {:action => 'edit'}, :method => 'post' do |f| %> | |
4 | +<%= form_for @provider, :url => {:action => 'edit', :id => @provider.id}, :method => 'post' do |f| %> | |
5 | 5 | |
6 | 6 | <div class="enabled"> |
7 | 7 | <%= labelled_form_field f.check_box(:enabled) + _('Enabled'), '' %> | ... | ... |
plugins/people_block/test/unit/friends_block_test.rb
... | ... | @@ -153,4 +153,59 @@ class FriendsBlockViewTest < ActionView::TestCase |
153 | 153 | |
154 | 154 | assert_tag_in_string render_block_footer(block), tag: 'a', attributes: {class: 'view-all', href: '/profile/mytestperson/friends' } |
155 | 155 | end |
156 | + | |
157 | + FACTOR = 1.8 | |
158 | + | |
159 | + # Testing blog page display. It should not present a linear increase in time | |
160 | + # needed to display a blog page with the increase in number of posts. | |
161 | + # | |
162 | + # GOOD BAD | |
163 | + # | |
164 | + # ^ ^ / | |
165 | + # | | / | |
166 | + # | _____ | / | |
167 | + # | / | / | |
168 | + # | / | / | |
169 | + # |/ |/ | |
170 | + # +---------> +---------> | |
171 | + # 0 50 100 0 50 100 | |
172 | + # | |
173 | + should 'not have a linear increase in time to display friends block' do | |
174 | + owner = fast_create(Person) | |
175 | + owner.boxes<< Box.new | |
176 | + block = FriendsBlock.create!(:box => owner.boxes.first) | |
177 | + | |
178 | + ActionView::Base.any_instance.stubs(:profile_image_link).returns('some name') | |
179 | + ActionView::Base.any_instance.stubs(:block_title).returns("") | |
180 | + | |
181 | + # no people | |
182 | + block.reload | |
183 | + time0 = (Benchmark.measure { 10.times { render_block_content(block) } }) | |
184 | + | |
185 | + # first 50 | |
186 | + 1.upto(50).map do |n| | |
187 | + p = create_user("user #{n}").person | |
188 | + owner.add_friend(p) | |
189 | + end | |
190 | + block.reload | |
191 | + time1 = (Benchmark.measure { 10.times { render_block_content(block) } }) | |
192 | + | |
193 | + # another 50 | |
194 | + 1.upto(50).map do |n| | |
195 | + p = create_user("user #{n}").person | |
196 | + owner.add_friend(p) | |
197 | + end | |
198 | + block.reload | |
199 | + time2 = (Benchmark.measure { 10.times { render_block_content(block) } }) | |
200 | + | |
201 | + # should not scale linearly, i.e. the inclination of the first segment must | |
202 | + # be a lot higher than the one of the segment segment. To compensate for | |
203 | + # small variations due to hardware and/or execution environment, we are | |
204 | + # satisfied if the the inclination of the first segment is at least twice | |
205 | + # the inclination of the second segment. | |
206 | + a1 = (time1.total - time0.total)/50.0 | |
207 | + a2 = (time2.total - time1.total)/50.0 | |
208 | + assert a1 > a2*FACTOR, "#{a1} should be larger than #{a2} by at least a factor of #{FACTOR}" | |
209 | + end | |
210 | + | |
156 | 211 | end | ... | ... |
plugins/people_block/test/unit/members_block_test.rb
... | ... | @@ -306,4 +306,60 @@ class MembersBlockViewTest < ActionView::TestCase |
306 | 306 | assert_select '[href=/profile/mytestuser/members#admins-tab]' |
307 | 307 | end |
308 | 308 | end |
309 | + | |
310 | + FACTOR = 1.8 | |
311 | + | |
312 | + # Testing blog page display. It should not present a linear increase in time | |
313 | + # needed to display a blog page with the increase in number of posts. | |
314 | + # | |
315 | + # GOOD BAD | |
316 | + # | |
317 | + # ^ ^ / | |
318 | + # | | / | |
319 | + # | _____ | / | |
320 | + # | / | / | |
321 | + # | / | / | |
322 | + # |/ |/ | |
323 | + # +---------> +---------> | |
324 | + # 0 50 100 0 50 100 | |
325 | + # | |
326 | + should 'not have a linear increase in time to display members block' do | |
327 | + owner = fast_create(Community) | |
328 | + owner.boxes<< Box.new | |
329 | + block = MembersBlock.create!(:box => owner.boxes.first) | |
330 | + | |
331 | + ActionView::Base.any_instance.stubs(:profile_image_link).returns('some name') | |
332 | + ActionView::Base.any_instance.stubs(:block_title).returns("") | |
333 | + | |
334 | + # no people | |
335 | + block.reload | |
336 | + time0 = (Benchmark.measure { 10.times { render_block_content(block) } }) | |
337 | + | |
338 | + 1.upto(50).map do |n| | |
339 | + p = create_user("user #{n}").person | |
340 | + owner.add_member(p) | |
341 | + end | |
342 | + | |
343 | + # first 50 | |
344 | + block.reload | |
345 | + time1 = (Benchmark.measure { 10.times { render_block_content(block) } }) | |
346 | + | |
347 | + 1.upto(50).map do |n| | |
348 | + p = create_user("user 1#{n}").person | |
349 | + owner.add_member(p) | |
350 | + end | |
351 | + block.reload | |
352 | + # another 50 | |
353 | + time2 = (Benchmark.measure { 10.times { render_block_content(block) } }) | |
354 | + | |
355 | + # should not scale linearly, i.e. the inclination of the first segment must | |
356 | + # be a lot higher than the one of the segment segment. To compensate for | |
357 | + # small variations due to hardware and/or execution environment, we are | |
358 | + # satisfied if the the inclination of the first segment is at least twice | |
359 | + # the inclination of the second segment. | |
360 | + a1 = (time1.total - time0.total)/50.0 | |
361 | + a2 = (time2.total - time1.total)/50.0 | |
362 | + assert a1 > a2*FACTOR, "#{a1} should be larger than #{a2} by at least a factor of #{FACTOR}" | |
363 | + end | |
364 | + | |
309 | 365 | end | ... | ... |
plugins/people_block/test/unit/people_block_test.rb
... | ... | @@ -145,4 +145,57 @@ class PeopleBlockViewTest < ActionView::TestCase |
145 | 145 | assert_select '[href=/search/people]' |
146 | 146 | end |
147 | 147 | end |
148 | + | |
149 | + FACTOR = 1.8 | |
150 | + | |
151 | + # Testing blog page display. It should not present a linear increase in time | |
152 | + # needed to display a blog page with the increase in number of posts. | |
153 | + # | |
154 | + # GOOD BAD | |
155 | + # | |
156 | + # ^ ^ / | |
157 | + # | | / | |
158 | + # | _____ | / | |
159 | + # | / | / | |
160 | + # | / | / | |
161 | + # |/ |/ | |
162 | + # +---------> +---------> | |
163 | + # 0 50 100 0 50 100 | |
164 | + # | |
165 | + should 'not have a linear increase in time to display people block' do | |
166 | + owner = fast_create(Environment) | |
167 | + owner.boxes<< Box.new | |
168 | + block = PeopleBlock.create!(:box => owner.boxes.first) | |
169 | + | |
170 | + ActionView::Base.any_instance.stubs(:profile_image_link).returns('some name') | |
171 | + ActionView::Base.any_instance.stubs(:block_title).returns("") | |
172 | + | |
173 | + # no people | |
174 | + block.reload | |
175 | + time0 = (Benchmark.measure { 10.times { render_block_content(block) } }) | |
176 | + | |
177 | + # first 500 | |
178 | + 1.upto(50).map do | |
179 | + fast_create(Person, :environment_id => owner.id) | |
180 | + end | |
181 | + block.reload | |
182 | + time1 = (Benchmark.measure { 10.times { render_block_content(block) } }) | |
183 | + | |
184 | + # another 50 | |
185 | + 1.upto(50).map do | |
186 | + fast_create(Person, :environment_id => owner.id) | |
187 | + end | |
188 | + block.reload | |
189 | + time2 = (Benchmark.measure { 10.times { render_block_content(block) } }) | |
190 | + | |
191 | + # should not scale linearly, i.e. the inclination of the first segment must | |
192 | + # be a lot higher than the one of the segment segment. To compensate for | |
193 | + # small variations due to hardware and/or execution environment, we are | |
194 | + # satisfied if the the inclination of the first segment is at least twice | |
195 | + # the inclination of the second segment. | |
196 | + a1 = (time1.total - time0.total)/50.0 | |
197 | + a2 = (time2.total - time1.total)/50.0 | |
198 | + assert a1 > a2*FACTOR, "#{a1} should be larger than #{a2} by at least a factor of #{FACTOR}" | |
199 | + end | |
200 | + | |
148 | 201 | end | ... | ... |
plugins/people_block/views/blocks/people_base.html.erb
... | ... | @@ -3,9 +3,9 @@ |
3 | 3 | <%= block_title(block.view_title) %> |
4 | 4 | |
5 | 5 | <div> |
6 | - <% unless block.profiles.count == 0 %> | |
6 | + <% unless block.profile_count == 0 %> | |
7 | 7 | <ul> |
8 | - <%= profiles_images_list(block.profiles) %> | |
8 | + <%= profiles_images_list(block.profile_list) %> | |
9 | 9 | |
10 | 10 | <% unless block.name.blank? || block.address.blank? %> |
11 | 11 | <div class="common-profile-list-block"> | ... | ... |