Commit 4251dcbc2ae5c540b6719fa64dac98909a18c1cd
Exists in
master
and in
29 other branches
Merge branch 'stable'
Conflicts: app/views/cms/view.rhtml test/functional/profile_controller_test.rb
Showing
127 changed files
with
562 additions
and
495 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 127 files displayed.
AUTHORS
... | ... | @@ -44,6 +44,7 @@ Antonio Terceiro <terceiro@colivre.coop.br> |
44 | 44 | Aurelio A. Heckert <aurelio@colivre.coop.br> |
45 | 45 | Braulio Bhavamitra <brauliobo@gmail.com> |
46 | 46 | Bráulio Bhavamitra <brauliobo@gmail.com> |
47 | +Braulio Bhavamitra <braulio@eita.org.br> | |
47 | 48 | Caio <caio.csalgado@gmail.com> |
48 | 49 | Caio + Diego + Pedro + João <caio.csalgado@gmail.com> |
49 | 50 | Caio Formiga <caio.formiga@gmail.com> |
... | ... | @@ -147,6 +148,7 @@ João M. M. Silva + Rafael Manzo <jaodsilv@linux.ime.usp.br> |
147 | 148 | João M. M. Silva + Renan Teruo <jaodsilv@linux.ime.usp.br> |
148 | 149 | Joenio Costa <joenio@colivre.coop.br> |
149 | 150 | Josef Spillner <josef.spillner@tu-dresden.de> |
151 | +Junior Silva <juniorsilva7@juniorsilva-Aspire-5750Z.(none)> | |
150 | 152 | Keilla Menezes <keilla@colivre.coop.br> |
151 | 153 | Larissa Reis <larissa@colivre.coop.br> |
152 | 154 | Larissa Reis <reiss.larissa@gmail.com> | ... | ... |
app/helpers/boxes_helper.rb
... | ... | @@ -99,9 +99,9 @@ module BoxesHelper |
99 | 99 | unless block.visible? |
100 | 100 | options[:title] = _("This block is invisible. Your visitors will not see it.") |
101 | 101 | end |
102 | - if @controller.send(:content_editor?) | |
103 | - result = filter_html(result, block) | |
104 | - end | |
102 | + | |
103 | + result = filter_html(result, block) | |
104 | + | |
105 | 105 | box_decorator.block_target(block.box, block) + |
106 | 106 | content_tag('div', |
107 | 107 | content_tag('div', | ... | ... |
app/helpers/cms_helper.rb
... | ... | @@ -28,7 +28,7 @@ module CmsHelper |
28 | 28 | end |
29 | 29 | |
30 | 30 | def link_to_article(article) |
31 | - article_name = short_filename(article.title, 30) | |
31 | + article_name = article.title | |
32 | 32 | if article.folder? |
33 | 33 | link_to article_name, {:action => 'view', :id => article.id}, :class => icon_for_article(article) |
34 | 34 | else | ... | ... |
app/models/action_tracker_notification.rb
... | ... | @@ -3,7 +3,7 @@ class ActionTrackerNotification < ActiveRecord::Base |
3 | 3 | belongs_to :profile |
4 | 4 | belongs_to :action_tracker, :class_name => 'ActionTracker::Record', :foreign_key => 'action_tracker_id' |
5 | 5 | |
6 | - has_many :comments, :through => :action_tracker, :class_name => 'Comment', :foreign_key => 'source_id' | |
6 | + delegate :comments, :to => :action_tracker, :allow_nil => true | |
7 | 7 | |
8 | 8 | validates_presence_of :profile_id, :action_tracker_id |
9 | 9 | validates_uniqueness_of :action_tracker_id, :scope => :profile_id | ... | ... |
app/models/article.rb
... | ... | @@ -57,7 +57,7 @@ class Article < ActiveRecord::Base |
57 | 57 | has_many :article_categorizations, :conditions => [ 'articles_categories.virtual = ?', false ] |
58 | 58 | has_many :categories, :through => :article_categorizations |
59 | 59 | |
60 | - has_many :article_categorizations_including_virtual, :class_name => 'ArticleCategorization', :dependent => :destroy | |
60 | + has_many :article_categorizations_including_virtual, :class_name => 'ArticleCategorization' | |
61 | 61 | has_many :categories_including_virtual, :through => :article_categorizations_including_virtual, :source => :category |
62 | 62 | |
63 | 63 | acts_as_having_settings :field => :setting | ... | ... |
app/models/category.rb
... | ... | @@ -22,23 +22,15 @@ class Category < ActiveRecord::Base |
22 | 22 | |
23 | 23 | named_scope :on_level, lambda { |parent| {:conditions => {:parent_id => parent}} } |
24 | 24 | |
25 | - named_scope :sub_categories, lambda { |category| | |
26 | - {:conditions => ['categories.path LIKE ? AND categories.id != ?', "%#{category.slug}%", category.id]} | |
27 | - } | |
28 | - | |
29 | - named_scope :sub_tree, lambda { |category| | |
30 | - {:conditions => ['categories.path LIKE ?', "%#{category.slug}%"]} | |
31 | - } | |
32 | - | |
33 | 25 | acts_as_filesystem |
34 | 26 | |
35 | - has_many :article_categorizations, :dependent => :destroy | |
27 | + has_many :article_categorizations | |
36 | 28 | has_many :articles, :through => :article_categorizations |
37 | 29 | has_many :comments, :through => :articles |
38 | 30 | |
39 | 31 | has_many :events, :through => :article_categorizations, :class_name => 'Event', :source => :article |
40 | 32 | |
41 | - has_many :profile_categorizations, :dependent => :destroy | |
33 | + has_many :profile_categorizations | |
42 | 34 | has_many :profiles, :through => :profile_categorizations, :source => :profile |
43 | 35 | has_many :enterprises, :through => :profile_categorizations, :source => :profile, :class_name => 'Enterprise' |
44 | 36 | has_many :people, :through => :profile_categorizations, :source => :profile, :class_name => 'Person' | ... | ... |
app/models/featured_products_block.rb
... | ... | @@ -7,8 +7,9 @@ class FeaturedProductsBlock < Block |
7 | 7 | |
8 | 8 | before_save do |block| |
9 | 9 | if block.owner.kind_of?(Environment) && block.product_ids.blank? |
10 | - seed = block.owner.products.count | |
11 | - block.product_ids = block.owner.highlighted_products_with_image(:offset => (rand(seed) % (seed - block.groups_of * 3)), :limit => block.groups_of * 3).map(&:id) | |
10 | + total = block.owner.products.count | |
11 | + offset = rand([(total - block.groups_of * 3) + 1, 1].max) | |
12 | + block.product_ids = block.owner.highlighted_products_with_image(:offset => offset, :limit => block.groups_of * 3).map(&:id) | |
12 | 13 | end |
13 | 14 | block.groups_of = block.groups_of.to_i |
14 | 15 | end | ... | ... |
app/models/person.rb
... | ... | @@ -471,8 +471,9 @@ class Person < Profile |
471 | 471 | Scrap.find_by_sql("SELECT id, updated_at, '#{Scrap.to_s}' AS klass FROM #{Scrap.table_name} WHERE scraps.receiver_id = #{self.id} AND scraps.scrap_id IS NULL UNION SELECT id, updated_at, '#{ActionTracker::Record.to_s}' AS klass FROM #{ActionTracker::Record.table_name} WHERE action_tracker.user_id = #{self.id} and action_tracker.verb != 'leave_scrap_to_self' and action_tracker.verb != 'add_member_in_community' ORDER BY updated_at DESC") |
472 | 472 | end |
473 | 473 | |
474 | + # by default, all fields are private | |
474 | 475 | def public_fields |
475 | - self.fields_privacy.nil? ? self.active_fields : self.fields_privacy.reject{ |k, v| v != 'public' }.keys.map(&:to_s) | |
476 | + self.fields_privacy.nil? ? [] : self.fields_privacy.reject{ |k, v| v != 'public' }.keys.map(&:to_s) | |
476 | 477 | end |
477 | 478 | |
478 | 479 | protected | ... | ... |
app/models/region.rb
... | ... | @@ -8,9 +8,9 @@ class Region < Category |
8 | 8 | validators.count > 0 |
9 | 9 | end |
10 | 10 | |
11 | - named_scope :with_validators, :group => 'id', | |
11 | + named_scope :with_validators, :select => 'DISTINCT ON (categories.id) *', | |
12 | 12 | :joins => 'INNER JOIN region_validators on (region_validators.region_id = categories.id)' |
13 | - | |
13 | + | |
14 | 14 | end |
15 | 15 | |
16 | 16 | require_dependency 'city' | ... | ... |
app/sweepers/profile_sweeper.rb
app/views/cms/view.rhtml
app/views/profile/_person_profile.rhtml
... | ... | @@ -18,18 +18,6 @@ |
18 | 18 | <% cache_timeout(profile.relationships_cache_key, 4.hours) do %> |
19 | 19 | <%= display_work_info profile %> |
20 | 20 | |
21 | - <% if !environment.enabled?('disable_asset_enterprises') && !profile.enterprises.empty? %> | |
22 | - <tr> | |
23 | - <th colspan='2'><%= __('Enterprises') %></th> | |
24 | - </tr> | |
25 | - <% profile.enterprises.includes(:environment,:domains, :preferred_domain).each do |item| %> | |
26 | - <tr> | |
27 | - <td></td> | |
28 | - <td><%= button 'menu-enterprise', item.name, item.url %></td> | |
29 | - </tr> | |
30 | - <% end %> | |
31 | - <% end %> | |
32 | - | |
33 | 21 | <tr> |
34 | 22 | <th colspan='2'><%= _('Network')%></th> |
35 | 23 | </tr> |
... | ... | @@ -41,6 +29,12 @@ |
41 | 29 | <td><%= __('Communities') + ':' %></td> |
42 | 30 | <td><%= link_to profile.communities.count, :controller => "profile", :action => 'communities' %></td> |
43 | 31 | </tr> |
32 | + <% if environment.disabled?('disable_asset_enterprises') %> | |
33 | + <tr id="person-profile-network-enterprises"> | |
34 | + <td><%= __('Enterprises') + ':' %></td> | |
35 | + <td><%= link_to profile.enterprises.count, :controller => "profile", :action => 'enterprises' %></td> | |
36 | + </tr> | |
37 | + <% end %> | |
44 | 38 | |
45 | 39 | <%= render :partial => 'common' %> |
46 | 40 | ... | ... |
app/views/profile_members/_members_list.rhtml
app/views/search/_full_article.html.erb
1 | 1 | <li class="search-article-item article-item"> |
2 | - <%= link_to(article.title, article.url, :class => "search-result-title") %> | |
2 | + <div> | |
3 | + <%= link_to(article.title, article.url, :class => "search-result-title") %> | |
4 | + </div> | |
5 | + | |
3 | 6 | <div class="search-content-first-column"> |
4 | 7 | <%= render :partial => 'image', :object => article %> |
5 | 8 | </div> |
9 | + | |
6 | 10 | <table class="noborder search-content-second-column"> |
7 | 11 | <%= render :partial => 'article_common', :object => article %> |
8 | 12 | </table> | ... | ... |
app/views/search/_full_blog.html.erb
1 | 1 | <li class="search-blog article-item"> |
2 | - <%= link_to blog.title, blog.view_url, :class => 'search-result-title' %> | |
2 | + <div> | |
3 | + <%= link_to blog.title, blog.view_url, :class => 'search-result-title' %> | |
4 | + </div> | |
5 | + | |
3 | 6 | <div class="search-content-first-column"> |
4 | 7 | <%= render :partial => 'image', :object => blog %> |
5 | 8 | </div> |
9 | + | |
6 | 10 | <table class="noborder search-content-second-column"> |
7 | 11 | <tr class="search-blog-items"> |
8 | 12 | <td class="search-field-label"><%= _("Last posts") %></td> | ... | ... |
app/views/search/_full_event.html.erb
1 | 1 | <li class="search-event-item article-item"> |
2 | -<%= link_to(event.title, event.url, :class => "search-result-title") %> | |
3 | -<div class="search-content-first-column"> | |
4 | - <%= render :partial => 'image', :object => event %> | |
5 | -</div> | |
6 | -<table class="noborder search-content-second-column"> | |
7 | - <% if event.start_date %> | |
8 | - <tr class="search-article-event-date"> | |
9 | - <td class="search-field-label"><%= _('Start date') %></td> | |
10 | - <td class="article-item-date"><%= event.start_date %></td> | |
11 | - </tr> | |
12 | - <% end %> | |
13 | - <% if event.end_date %> | |
14 | - <tr class="search-article-event-date"> | |
15 | - <td class="search-field-label"><%= _('End date') %></td> | |
16 | - <td class="article-item-date"><%= event.end_date %></td> | |
17 | - </tr> | |
18 | - <% end %> | |
2 | + <div> | |
3 | + <%= link_to(event.title, event.url, :class => "search-result-title") %> | |
4 | + </div> | |
19 | 5 | |
20 | - <%= render :partial => 'article_common', :object => event %> | |
21 | -</table> | |
22 | -<%= render :partial => 'article_last_change', :object => event %> | |
6 | + <div class="search-content-first-column"> | |
7 | + <%= render :partial => 'image', :object => event %> | |
8 | + </div> | |
23 | 9 | |
24 | -<div style="clear: both"></div> | |
10 | + <table class="noborder search-content-second-column"> | |
11 | + <% if event.start_date %> | |
12 | + <tr class="search-article-event-date"> | |
13 | + <td class="search-field-label"><%= _('Start date') %></td> | |
14 | + <td class="article-item-date"><%= event.start_date %></td> | |
15 | + </tr> | |
16 | + <% end %> | |
17 | + <% if event.end_date %> | |
18 | + <tr class="search-article-event-date"> | |
19 | + <td class="search-field-label"><%= _('End date') %></td> | |
20 | + <td class="article-item-date"><%= event.end_date %></td> | |
21 | + </tr> | |
22 | + <% end %> | |
23 | + | |
24 | + <%= render :partial => 'article_common', :object => event %> | |
25 | + </table> | |
26 | + <%= render :partial => 'article_last_change', :object => event %> | |
27 | + | |
28 | + <div style="clear: both"></div> | |
25 | 29 | </li> | ... | ... |
app/views/search/_full_folder.html.erb
1 | 1 | <li class="search-folder-item article-item"> |
2 | - <%= link_to folder.title, folder.view_url, :class => 'search-result-title' %> | |
2 | + <div> | |
3 | + <%= link_to folder.title, folder.view_url, :class => 'search-result-title' %> | |
4 | + </div> | |
5 | + | |
3 | 6 | <div class="search-content-first-column"> |
4 | 7 | <%= render :partial => 'image', :object => folder %> |
5 | 8 | </div> |
9 | + | |
6 | 10 | <table class="noborder search-content-second-column"> |
7 | 11 | <tr class="search-folder-items"> |
8 | 12 | <td class="search-field-label"><%= _("Last items") %></td> | ... | ... |
app/views/search/_full_forum.html.erb
1 | 1 | <li class="search-forum-item article-item"> |
2 | - <%= link_to forum.title, forum.view_url, :class => 'search-result-title' %> | |
2 | + <div> | |
3 | + <%= link_to forum.title, forum.view_url, :class => 'search-result-title' %> | |
4 | + </div> | |
5 | + | |
3 | 6 | <div class="search-content-first-column"> |
4 | 7 | <%= render :partial => 'image', :object => forum %> |
5 | 8 | </div> |
9 | + | |
6 | 10 | <table class="noborder search-content-second-column"> |
7 | 11 | <tr class="search-forum-items"> |
8 | 12 | <td class="search-field-label"><%= _("Last topics") %></td> | ... | ... |
app/views/search/_full_gallery.html.erb
1 | 1 | <li class="search-gallery article-item"> |
2 | - <%= link_to gallery.title, gallery.view_url, :class => 'search-result-title' %> | |
2 | + <div> | |
3 | + <%= link_to gallery.title, gallery.view_url, :class => 'search-result-title' %> | |
4 | + </div> | |
5 | + | |
3 | 6 | <div class="search-content-first-column"> |
4 | 7 | <%= render :partial => 'image', :object => gallery %> |
5 | 8 | </div> |
9 | + | |
6 | 10 | <table class="noborder search-content-second-column"> |
7 | 11 | <%= render :partial => 'article_common', :object => gallery %> |
8 | 12 | </table> | ... | ... |
app/views/search/_full_text_article.html.erb
1 | 1 | <li class="search-text-article-item article-item"> |
2 | - <%= link_to(text_article.title, text_article.url, :class => "search-result-title") %> | |
2 | + <div> | |
3 | + <%= link_to(text_article.title, text_article.url, :class => "search-result-title") %> | |
4 | + </div> | |
3 | 5 | |
4 | 6 | <div class="search-content-first-column"> |
5 | 7 | <%= render :partial => 'image', :object => text_article %> | ... | ... |
app/views/search/_full_uploaded_file.html.erb
1 | 1 | <li class="search-uploaded-file-item article-item"> |
2 | - <%= link_to uploaded_file.filename, uploaded_file.view_url, :class => 'search-result-title' %> | |
2 | + <div> | |
3 | + <%= link_to uploaded_file.filename, uploaded_file.view_url, :class => 'search-result-title' %> | |
4 | + </div> | |
3 | 5 | |
4 | 6 | <div class="search-content-first-column"> |
5 | 7 | <%= render :partial => 'image', :object => uploaded_file %> | ... | ... |
app/views/shared/tiny_mce.rhtml
... | ... | @@ -70,7 +70,7 @@ tinyMCE.init({ |
70 | 70 | paste_insert_word_content_callback : "convertWord", |
71 | 71 | paste_use_dialog: false, |
72 | 72 | apply_source_formatting : true, |
73 | - extended_valid_elements : "applet[style|archive|codebase|code|height|width],comment,iframe[src|style|allowtransparency|frameborder|width|height|scrolling],embed[title|src|type|height|width]", | |
73 | + extended_valid_elements : "applet[style|archive|codebase|code|height|width],comment,iframe[src|style|allowtransparency|frameborder|width|height|scrolling],embed[title|src|type|height|width],audio[controls|autoplay],video[controls|autoplay],source[src|type]", | |
74 | 74 | content_css: '/stylesheets/tinymce.css,<%= macro_css_files %>', |
75 | 75 | language: <%= tinymce_language.inspect %>, |
76 | 76 | entity_encoding: 'raw', | ... | ... |
config/environment.rb
... | ... | @@ -85,10 +85,10 @@ Rails::Initializer.run do |config| |
85 | 85 | } |
86 | 86 | |
87 | 87 | # Adds custom attributes to the Set of allowed html attributes for the #sanitize helper |
88 | - config.action_view.sanitized_allowed_attributes = 'align', 'border', 'alt', 'vspace', 'hspace', 'width', 'heigth', 'value', 'type', 'data', 'style', 'target', 'codebase', 'archive', 'classid', 'code', 'flashvars', 'scrolling', 'frameborder' | |
88 | + config.action_view.sanitized_allowed_attributes = 'align', 'border', 'alt', 'vspace', 'hspace', 'width', 'heigth', 'value', 'type', 'data', 'style', 'target', 'codebase', 'archive', 'classid', 'code', 'flashvars', 'scrolling', 'frameborder', 'controls', 'autoplay' | |
89 | 89 | |
90 | 90 | # Adds custom tags to the Set of allowed html tags for the #sanitize helper |
91 | - config.action_view.sanitized_allowed_tags = 'object', 'embed', 'param', 'table', 'tr', 'th', 'td', 'applet', 'comment', 'iframe' | |
91 | + config.action_view.sanitized_allowed_tags = 'object', 'embed', 'param', 'table', 'tr', 'th', 'td', 'applet', 'comment', 'iframe', 'audio', 'video', 'source' | |
92 | 92 | |
93 | 93 | # See Rails::Configuration for more options |
94 | 94 | ... | ... |
db/schema.rb
... | ... | @@ -221,7 +221,6 @@ ActiveRecord::Schema.define(:version => 20130711213046) do |
221 | 221 | t.string "source_type" |
222 | 222 | t.string "user_agent" |
223 | 223 | t.string "referrer" |
224 | - t.integer "group_id" | |
225 | 224 | end |
226 | 225 | |
227 | 226 | add_index "comments", ["source_id", "spam"], :name => "index_comments_on_source_id_and_spam" | ... | ... |
debian/changelog
features/edit_article.feature
... | ... | @@ -64,8 +64,8 @@ Feature: edit article |
64 | 64 | And I fill in "Tag list" with "aurium, bug" |
65 | 65 | And I press "Save" |
66 | 66 | And I go to /joaosilva/article-with-tags |
67 | - Then I should see "aurium" within "#article-tags a:first" | |
68 | - And I should see "bug" within "#article-tags a:last" | |
67 | + Then I should see "aurium" within "#article-tags" | |
68 | + And I should see "bug" within "#article-tags" | |
69 | 69 | |
70 | 70 | Scenario: redirect to the created article |
71 | 71 | Given I am on joaosilva's control panel | ... | ... |
features/last_administrator_leaving.feature
... | ... | @@ -17,7 +17,7 @@ Feature: remove administrator role |
17 | 17 | Scenario: the last administrator removes his administrator role and must choose the new administrator |
18 | 18 | Given "Maria Souza" is a member of "Nice people" |
19 | 19 | And I am on Nice people's members management |
20 | - And I follow "Edit" | |
20 | + And I follow "Edit" within "tr[title='Joao Silva']" | |
21 | 21 | And I uncheck "Profile Administrator" |
22 | 22 | When I press "Save changes" |
23 | 23 | Then I should see "Since you are the last administrator, you must choose" | ... | ... |
features/plugins.feature
... | ... | @@ -22,27 +22,27 @@ Feature: plugins |
22 | 22 | | profile_tabs | lambda { {:title => 'Test plugin tab', :id => 'test_plugin', :content => lambda {'Test plugin random content'} } } | |
23 | 23 | |
24 | 24 | Scenario: a user must see the plugin\'s button in the control panel if the plugin is enabled |
25 | - Given plugin TestPlugin is enabled on environment | |
25 | + Given plugin Test is enabled on environment | |
26 | 26 | And I go to joaosilva's control panel |
27 | 27 | Then I should see "Test plugin button" |
28 | 28 | |
29 | 29 | Scenario: a user must see the plugin\'s tab in in the profile if the plugin is enabled |
30 | - Given plugin TestPlugin is enabled on environment | |
30 | + Given plugin Test is enabled on environment | |
31 | 31 | And I am on joaosilva's profile |
32 | 32 | Then I should see "Test plugin tab" |
33 | 33 | |
34 | 34 | Scenario: a user must not see the plugin\'s button in the control panel if the plugin is disabled |
35 | - Given plugin TestPlugin is disabled on environment | |
35 | + Given plugin Test is disabled on environment | |
36 | 36 | And I go to joaosilva's control panel |
37 | 37 | Then I should not see "Test plugin button" |
38 | 38 | |
39 | 39 | Scenario: a user must not see the plugin\'s tab in in the profile if the plugin is disabled |
40 | - Given plugin TestPlugin is disabled on environment | |
40 | + Given plugin Test is disabled on environment | |
41 | 41 | And I am on joaosilva's profile |
42 | 42 | Then I should not see "Test plugin tab" |
43 | 43 | |
44 | 44 | Scenario: an admin should be able to deactivate a plugin |
45 | - Given plugin TestPlugin is enabled on environment | |
45 | + Given plugin Test is enabled on environment | |
46 | 46 | And I am logged in as admin |
47 | 47 | When I go to admin_user's control panel |
48 | 48 | Then I should see "Test plugin button" | ... | ... |
features/search_communities.feature
... | ... | @@ -4,7 +4,8 @@ Feature: search communities |
4 | 4 | In order to find ones that interest me |
5 | 5 | |
6 | 6 | Background: |
7 | - Given the following category | |
7 | + Given plugin Solr is enabled on environment | |
8 | + And the following category | |
8 | 9 | | name | |
9 | 10 | | social network | |
10 | 11 | And the following community | ... | ... |
features/short_filename.feature
... | ... | @@ -18,4 +18,4 @@ Feature: sitemap |
18 | 18 | Scenario: view the CMS |
19 | 19 | Given I am logged in as "joaosilva" |
20 | 20 | When I am on /myprofile/joaosilva/cms |
21 | - Then I should see "AGENDA_CULTURA_-_FEST(...).txt" | |
21 | + Then I should see "AGENDA_CULTURA_-_FESTA_DE_VAQUEIROS_PONTO_DE_SERRA_(...).txt" | ... | ... |
features/step_definitions/noosfero_steps.rb
... | ... | @@ -44,7 +44,7 @@ Given /^the following (community|communities|enterprises?|organizations?)$/ do | |
44 | 44 | end |
45 | 45 | if category && !category.blank? |
46 | 46 | cat = Category.find_by_slug category |
47 | - organization.categories << cat | |
47 | + ProfileCategorization.add_category_to_profile(cat, organization) | |
48 | 48 | end |
49 | 49 | if img_name |
50 | 50 | img = Image.create!(:uploaded_data => fixture_file_upload('/files/'+img_name+'.png', 'image/png')) | ... | ... |
features/step_definitions/plugin_steps.rb
lib/noosfero.rb
lib/noosfero/plugin.rb
... | ... | @@ -0,0 +1 @@ |
1 | +raise "Not ready yet" | ... | ... |
plugins/bsc/lib/bsc_plugin.rb
plugins/comment_group/lib/comment_group_plugin.rb
plugins/comment_group/lib/comment_group_plugin/ext/article.rb
... | ... | @@ -1,21 +0,0 @@ |
1 | -require_dependency 'article' | |
2 | - | |
3 | -class Article | |
4 | - | |
5 | - #FIXME make this test | |
6 | - has_many :group_comments, :class_name => 'Comment', :foreign_key => 'source_id', :dependent => :destroy, :order => 'created_at asc', :conditions => [ 'group_id IS NOT NULL'] | |
7 | - | |
8 | - #FIXME make this test | |
9 | - validate :not_empty_group_comments_removed | |
10 | - | |
11 | - #FIXME make this test | |
12 | - def not_empty_group_comments_removed | |
13 | - if body | |
14 | - groups_with_comments = group_comments.collect {|comment| comment.group_id}.uniq | |
15 | - groups = Hpricot(body.to_s).search('.macro').collect{|element| element['data-macro-group_id'].to_i} | |
16 | - errors.add_to_base(N_('Not empty group comment cannot be removed')) unless (groups_with_comments-groups).empty? | |
17 | - end | |
18 | - end | |
19 | - | |
20 | -end | |
21 | - |
plugins/comment_group/lib/comment_group_plugin/ext/comment.rb
... | ... | @@ -0,0 +1,21 @@ |
1 | +require_dependency 'article' | |
2 | + | |
3 | +class Article | |
4 | + | |
5 | + #FIXME make this test | |
6 | + has_many :group_comments, :class_name => 'Comment', :foreign_key => 'source_id', :dependent => :destroy, :order => 'created_at asc', :conditions => [ 'group_id IS NOT NULL'] | |
7 | + | |
8 | + #FIXME make this test | |
9 | + validate :not_empty_group_comments_removed | |
10 | + | |
11 | + #FIXME make this test | |
12 | + def not_empty_group_comments_removed | |
13 | + if body | |
14 | + groups_with_comments = group_comments.collect {|comment| comment.group_id}.uniq | |
15 | + groups = Hpricot(body.to_s).search('.macro').collect{|element| element['data-macro-group_id'].to_i} | |
16 | + errors.add_to_base(N_('Not empty group comment cannot be removed')) unless (groups_with_comments-groups).empty? | |
17 | + end | |
18 | + end | |
19 | + | |
20 | +end | |
21 | + | ... | ... |
plugins/comment_group/test/unit/comment_group_plugin_test.rb
... | ... | @@ -10,15 +10,17 @@ class CommentGroupPluginTest < ActiveSupport::TestCase |
10 | 10 | |
11 | 11 | attr_reader :environment |
12 | 12 | |
13 | - should 'filter_comments returns all the comments wihout group of an article passed as parameter' do | |
14 | - article = fast_create(Article) | |
15 | - c1 = fast_create(Comment, :source_id => article.id, :group_id => 1) | |
16 | - c2 = fast_create(Comment, :source_id => article.id) | |
17 | - c3 = fast_create(Comment, :source_id => article.id) | |
18 | - | |
19 | - plugin = CommentGroupPlugin.new | |
20 | - assert_equal [], [c2, c3] - plugin.filter_comments(article.comments) | |
21 | - assert_equal [], plugin.filter_comments(article.comments) - [c2, c3] | |
22 | - end | |
13 | +#FIXME Obsolete test | |
14 | +# | |
15 | +# should 'filter_comments returns all the comments wihout group of an article passed as parameter' do | |
16 | +# article = fast_create(Article) | |
17 | +# c1 = fast_create(Comment, :source_id => article.id, :group_id => 1) | |
18 | +# c2 = fast_create(Comment, :source_id => article.id) | |
19 | +# c3 = fast_create(Comment, :source_id => article.id) | |
20 | +# | |
21 | +# plugin = CommentGroupPlugin.new | |
22 | +# assert_equal [], [c2, c3] - plugin.filter_comments(article.comments) | |
23 | +# assert_equal [], plugin.filter_comments(article.comments) - [c2, c3] | |
24 | +# end | |
23 | 25 | |
24 | 26 | end | ... | ... |
plugins/custom_forms/db/migrate/20130822001407_set_position_to_existent_custom_forms_plugin_fields.rb
0 → 100644
... | ... | @@ -0,0 +1,9 @@ |
1 | +class SetPositionToExistentCustomFormsPluginFields < ActiveRecord::Migration | |
2 | + def self.up | |
3 | + update("UPDATE custom_forms_plugin_fields SET position = 0 WHERE position IS NULL") | |
4 | + end | |
5 | + | |
6 | + def self.down | |
7 | + say("Nothing to undo (cannot recover the data)") | |
8 | + end | |
9 | +end | ... | ... |
plugins/custom_forms/lib/custom_forms_plugin.rb
plugins/custom_forms/lib/custom_forms_plugin/field.rb
... | ... | @@ -15,8 +15,12 @@ class CustomFormsPlugin::Field < ActiveRecord::Base |
15 | 15 | |
16 | 16 | before_create do |field| |
17 | 17 | if field.form.fields.exists? |
18 | - field.position = field.form.fields.order('position').last.position + 1 | |
18 | + field.position = field.form.fields.order(:position).last.position + 1 | |
19 | 19 | end |
20 | 20 | end |
21 | + | |
22 | + def position | |
23 | + self[:position] || 0 | |
24 | + end | |
21 | 25 | end |
22 | 26 | ... | ... |
plugins/custom_forms/test/unit/custom_forms_plugin/field_test.rb
... | ... | @@ -81,5 +81,17 @@ class CustomFormsPlugin::FieldTest < ActiveSupport::TestCase |
81 | 81 | assert_equal 1, field_1.position |
82 | 82 | assert_equal 2, field_2.position |
83 | 83 | end |
84 | + | |
85 | + should 'not crash when adding new fields on a form with fields without position' do | |
86 | + form = CustomFormsPlugin::Form.create(:name => 'Free Software', :profile => fast_create(Profile)) | |
87 | + field_0 = CustomFormsPlugin::Field.create(:name => 'License', :form => form) | |
88 | + field_0.position = nil | |
89 | + field_0.save | |
90 | + | |
91 | + assert_nothing_raised do | |
92 | + field_1 = CustomFormsPlugin::Field.create!(:name => 'URL', :form => form) | |
93 | + end | |
94 | + end | |
95 | + | |
84 | 96 | end |
85 | 97 | ... | ... |
plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb
... | ... | @@ -41,7 +41,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
41 | 41 | Article.delete_all |
42 | 42 | get :index, :block_id => block.id |
43 | 43 | json_response = ActiveSupport::JSON.decode(@response.body) |
44 | - assert_equal [], json_response | |
44 | + assert_equivalent [], json_response | |
45 | 45 | end |
46 | 46 | |
47 | 47 | should 'index action returns an json with node content' do |
... | ... | @@ -53,7 +53,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
53 | 53 | expected_json = {'data' => article.title} |
54 | 54 | expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id} |
55 | 55 | |
56 | - assert_equal [expected_json], json_response | |
56 | + assert_equivalent [expected_json], json_response | |
57 | 57 | end |
58 | 58 | |
59 | 59 | should 'index action returns an json with node checked if the node is in the nodes list' do |
... | ... | @@ -68,7 +68,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
68 | 68 | expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id} |
69 | 69 | expected_json['attr'].merge!({'class' => 'jstree-checked'}) |
70 | 70 | |
71 | - assert_equal [expected_json], json_response | |
71 | + assert_equivalent [expected_json], json_response | |
72 | 72 | end |
73 | 73 | |
74 | 74 | should 'index action returns an json with node undetermined if the node is in the parent nodes list' do |
... | ... | @@ -84,7 +84,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
84 | 84 | expected_json['attr'].merge!({'class' => 'jstree-undetermined'}) |
85 | 85 | expected_json['children'] = [] |
86 | 86 | |
87 | - assert_equal [expected_json], json_response | |
87 | + assert_equivalent [expected_json], json_response | |
88 | 88 | end |
89 | 89 | |
90 | 90 | should 'index action returns an json with node closed if the node has article with children' do |
... | ... | @@ -98,7 +98,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
98 | 98 | expected_json['attr'] = { 'node_id' => f.id, 'parent_id' => f.parent_id} |
99 | 99 | expected_json['state'] = 'closed' |
100 | 100 | |
101 | - assert_equal [expected_json], json_response | |
101 | + assert_equivalent [expected_json], json_response | |
102 | 102 | end |
103 | 103 | |
104 | 104 | should 'index action returns an json with all the children nodes if some parent is in the parents list' do |
... | ... | @@ -121,7 +121,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
121 | 121 | expected_json['children'] = children |
122 | 122 | expected_json['state'] = 'closed' |
123 | 123 | |
124 | - assert_equal [expected_json], json_response | |
124 | + assert_equivalent [expected_json], json_response | |
125 | 125 | end |
126 | 126 | |
127 | 127 | should 'index action returns an json with all the children nodes and root nodes if some parent is in the parents list and there is others root articles' do |
... | ... | @@ -151,7 +151,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
151 | 151 | value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id} |
152 | 152 | expected_json.push(value) |
153 | 153 | |
154 | - assert_equal expected_json, json_response | |
154 | + assert_equivalent expected_json, json_response | |
155 | 155 | end |
156 | 156 | |
157 | 157 | should 'index action returns an json without children nodes if the parent is not in the parents list' do |
... | ... | @@ -173,7 +173,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
173 | 173 | value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id} |
174 | 174 | expected_json.push(value) |
175 | 175 | |
176 | - assert_equal expected_json, json_response | |
176 | + assert_equivalent expected_json, json_response | |
177 | 177 | end |
178 | 178 | |
179 | 179 | end | ... | ... |
plugins/display_content/test/functional/display_content_plugin_myprofile_controller_test.rb
... | ... | @@ -41,7 +41,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
41 | 41 | Article.delete_all |
42 | 42 | get :index, :block_id => block.id, :profile => profile.identifier |
43 | 43 | json_response = ActiveSupport::JSON.decode(@response.body) |
44 | - assert_equal [], json_response | |
44 | + assert_equivalent [], json_response | |
45 | 45 | end |
46 | 46 | |
47 | 47 | should 'index action returns an json with node content' do |
... | ... | @@ -53,7 +53,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
53 | 53 | expected_json = {'data' => article.title} |
54 | 54 | expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id} |
55 | 55 | |
56 | - assert_equal [expected_json], json_response | |
56 | + assert_equivalent [expected_json], json_response | |
57 | 57 | end |
58 | 58 | |
59 | 59 | should 'index action returns an json with node checked if the node is in the nodes list' do |
... | ... | @@ -68,7 +68,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
68 | 68 | expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id} |
69 | 69 | expected_json['attr'].merge!({'class' => 'jstree-checked'}) |
70 | 70 | |
71 | - assert_equal [expected_json], json_response | |
71 | + assert_equivalent [expected_json], json_response | |
72 | 72 | end |
73 | 73 | |
74 | 74 | should 'index action returns an json with node undetermined if the node is in the parent nodes list' do |
... | ... | @@ -84,7 +84,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
84 | 84 | expected_json['attr'].merge!({'class' => 'jstree-undetermined'}) |
85 | 85 | expected_json['children'] = [] |
86 | 86 | |
87 | - assert_equal [expected_json], json_response | |
87 | + assert_equivalent [expected_json], json_response | |
88 | 88 | end |
89 | 89 | |
90 | 90 | should 'index action returns an json with node closed if the node has article with children' do |
... | ... | @@ -99,7 +99,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
99 | 99 | expected_json['attr'] = { 'node_id' => f.id, 'parent_id' => f.parent_id} |
100 | 100 | expected_json['state'] = 'closed' |
101 | 101 | |
102 | - assert_equal [expected_json], json_response | |
102 | + assert_equivalent [expected_json], json_response | |
103 | 103 | end |
104 | 104 | |
105 | 105 | should 'index action returns an json with all the children nodes if some parent is in the parents list' do |
... | ... | @@ -122,7 +122,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
122 | 122 | expected_json['children'] = children |
123 | 123 | expected_json['state'] = 'closed' |
124 | 124 | |
125 | - assert_equal [expected_json], json_response | |
125 | + assert_equivalent [expected_json], json_response | |
126 | 126 | end |
127 | 127 | |
128 | 128 | should 'index action returns an json with all the children nodes and root nodes if some parent is in the parents list and there is others root articles' do |
... | ... | @@ -152,7 +152,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
152 | 152 | value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id} |
153 | 153 | expected_json.push(value) |
154 | 154 | |
155 | - assert_equal expected_json, json_response | |
155 | + assert_equivalent expected_json, json_response | |
156 | 156 | end |
157 | 157 | |
158 | 158 | should 'index action returns an json without children nodes if the parent is not in the parents list' do |
... | ... | @@ -174,7 +174,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
174 | 174 | value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id} |
175 | 175 | expected_json.push(value) |
176 | 176 | |
177 | - assert_equal expected_json, json_response | |
177 | + assert_equivalent expected_json, json_response | |
178 | 178 | end |
179 | 179 | |
180 | 180 | end | ... | ... |
plugins/foo/lib/foo_plugin.rb
plugins/foo/lib/foo_plugin/ext/profile.rb
plugins/google_analytics/lib/google_analytics_plugin.rb
plugins/ldap/dependencies.rb
... | ... | @@ -0,0 +1,5 @@ |
1 | +system "gem install --user-install net-ldap -v 0.3.1" | |
2 | +puts "\nWARNING: This plugin is not setting up a ldap test server automatically. | |
3 | +Some tests may not be running. If you want to fully test this plugin, please | |
4 | +setup the ldap test server and make the proper configurations on | |
5 | +fixtures/ldap.yml.\n\n" | ... | ... |
plugins/ldap/lib/ldap_plugin.rb
... | ... | @@ -0,0 +1 @@ |
1 | +raise "Not ready yet" | ... | ... |
plugins/pg_search/lib/pg_search_plugin.rb
plugins/require_auth_to_comment/lib/require_auth_to_comment_plugin.rb
plugins/require_auth_to_comment/lib/require_auth_to_comment_plugin/ext/profile.rb
plugins/send_email/features/send_email_plugin.feature
... | ... | @@ -7,7 +7,7 @@ Feature: send_email_plugin |
7 | 7 | And I am logged in as "joaosilva" |
8 | 8 | |
9 | 9 | Scenario: expand macro in article content |
10 | - Given plugin SendEmailPlugin is enabled on environment | |
10 | + Given plugin SendEmail is enabled on environment | |
11 | 11 | And the following articles |
12 | 12 | | owner | name | body | |
13 | 13 | | joaosilva | sample-article | URL path to {sendemail} action | |
... | ... | @@ -15,7 +15,7 @@ Feature: send_email_plugin |
15 | 15 | Then I should see "URL path to /profile/joaosilva/plugin/send_email/deliver action" |
16 | 16 | |
17 | 17 | Scenario: expand macro in block content |
18 | - Given plugin SendEmailPlugin is enabled on environment | |
18 | + Given plugin SendEmail is enabled on environment | |
19 | 19 | And the following blocks |
20 | 20 | | owner | type | html | |
21 | 21 | | joaosilva | RawHTMLBlock | URL path to {sendemail} action | | ... | ... |
plugins/shopping_cart/controllers/shopping_cart_plugin_myprofile_controller.rb
... | ... | @@ -63,6 +63,7 @@ class ShoppingCartPluginMyprofileController < MyProfileController |
63 | 63 | |
64 | 64 | def treat_delivery_options(params) |
65 | 65 | result = {} |
66 | + return result if params.nil? || params[:delivery_options].nil? | |
66 | 67 | params[:options].size.times do |counter| |
67 | 68 | if params[:options][counter].present? && params[:prices][counter].present? |
68 | 69 | result[params[:options][counter]] = params[:prices][counter] | ... | ... |
plugins/shopping_cart/lib/shopping_cart_plugin.rb
plugins/shopping_cart/lib/shopping_cart_plugin/ext/enterprise.rb
plugins/shopping_cart/lib/shopping_cart_plugin/ext/person.rb
plugins/shopping_cart/test/unit/shopping_cart_plugin/cart_helper_test.rb
... | ... | @@ -38,7 +38,7 @@ class ShoppingCartPlugin::CartHelperTest < ActiveSupport::TestCase |
38 | 38 | value = 13.7 |
39 | 39 | environment = Environment.default |
40 | 40 | |
41 | - assert_equal "#{environment.currency_unit} 13#{environment.currency_separator}70", float_to_currency_cart(value,environment) | |
41 | + assert_equal "#{environment.currency_unit}13#{environment.currency_separator}70", float_to_currency_cart(value,environment) | |
42 | 42 | end |
43 | 43 | |
44 | 44 | end | ... | ... |
plugins/shopping_cart/test/unit/shopping_cart_plugin_test.rb
... | ... | @@ -19,10 +19,9 @@ class ShoppingCartPluginTest < ActiveSupport::TestCase |
19 | 19 | end |
20 | 20 | |
21 | 21 | should 'not add button if product unavailable' do |
22 | - product = fast_create(Product, :available => false) | |
23 | - enterprise = mock() | |
22 | + enterprise = fast_create(:enterprise) | |
23 | + product = fast_create(Product, :available => false, :enterprise_id => enterprise.id) | |
24 | 24 | enterprise.stubs(:shopping_cart).returns(true) |
25 | - product.stubs(:enterprise).returns(enterprise) | |
26 | 25 | |
27 | 26 | assert_nil shopping_cart.add_to_cart_button(product) |
28 | 27 | end | ... | ... |
plugins/solr/features/.search_products.feature.swp
No preview for this file type
plugins/solr/features/search_contents.feature
plugins/solr/features/search_enterprises.feature
... | ... | @@ -5,6 +5,7 @@ Feature: search enterprises |
5 | 5 | |
6 | 6 | Background: |
7 | 7 | Given the search index is empty |
8 | + And plugin Solr is enabled on environment | |
8 | 9 | And the following enterprises |
9 | 10 | | identifier | name | img | |
10 | 11 | | shop1 | Shoes shop | shoes | |
... | ... | @@ -12,6 +13,7 @@ Feature: search enterprises |
12 | 13 | And the following categories as facets |
13 | 14 | | name | |
14 | 15 | | Temáticas | |
16 | + | |
15 | 17 | Scenario: see default facets when searching |
16 | 18 | When I go to the search enterprises page |
17 | 19 | And I fill in "search-input" with "shoes" |
... | ... | @@ -34,10 +36,10 @@ Feature: search enterprises |
34 | 36 | When I go to the search enterprises page |
35 | 37 | And I fill in "search-input" with "Artesanato" |
36 | 38 | And I press "Search" |
37 | - Then I should see "Pres. Prudente" within "#facet-menu-f_region" | |
38 | - And I should see ", SP" within "#facet-menu-f_region" | |
39 | - And I should see "City" within ".search-enterprise-region-label" | |
40 | - And I should see "Pres. Prudente, SP" within ".search-enterprise-region-name" | |
39 | + Then I should see "Pres. Prudente" within "#facet-menu-solr_plugin_f_region" | |
40 | + And I should see ", SP" within "#facet-menu-solr_plugin_f_region" | |
41 | + And I should see "City" within ".facet-menu-label" | |
42 | + And I should see "Pres. Prudente, SP" within ".facet-menu-item" | |
41 | 43 | |
42 | 44 | Scenario: find enterprise by region |
43 | 45 | Given the following cities | ... | ... |
plugins/solr/features/search_people.feature
plugins/solr/features/search_products.feature
plugins/solr/features/step_definitions/solr_steps.rb
... | ... | @@ -0,0 +1,14 @@ |
1 | +raise "Not ready yet. Some tests are failing." | |
2 | +require 'rubygems' | |
3 | +require 'rake' | |
4 | + | |
5 | +tasks_dir = File.join(File.dirname(__FILE__), 'vendor', 'plugins', 'acts_as_solr_reloaded', 'lib', 'tasks', '*.rake') | |
6 | + | |
7 | +Dir[tasks_dir].each do |file| | |
8 | + load file | |
9 | +end | |
10 | + | |
11 | +begin | |
12 | + Rake::Task['solr:download'].invoke | |
13 | +rescue Exception => exception | |
14 | +end | ... | ... |
plugins/solr/lib/.solr_plugin.rb.swp
No preview for this file type
plugins/solr/lib/solr_plugin.rb
... | ... | @@ -6,8 +6,6 @@ class SolrPlugin < Noosfero::Plugin |
6 | 6 | |
7 | 7 | include SolrPlugin::SearchHelper |
8 | 8 | |
9 | - delegate :params, :current_user, :to => :context | |
10 | - | |
11 | 9 | def self.plugin_name |
12 | 10 | "Solr" |
13 | 11 | end |
... | ... | @@ -28,11 +26,16 @@ class SolrPlugin < Noosfero::Plugin |
28 | 26 | return if empty_query?(query, category) && klass != Product |
29 | 27 | |
30 | 28 | solr_options = solr_options(class_asset(klass), category) |
31 | - user = context.send(:logged_in?) ? context.send(:user) : nil | |
32 | 29 | solr_options.merge!(products_options(user)) if klass == Product && empty_query?(query, category) |
33 | 30 | klass.find_by_contents(query, paginate_options, solr_options.merge(options)) |
34 | 31 | end |
35 | 32 | |
36 | -end | |
33 | + def method_missing method, *args, &block | |
34 | + if self.context.respond_to? method | |
35 | + self.context.send method, *args, &block | |
36 | + else | |
37 | + super method, *args, &block | |
38 | + end | |
39 | + end | |
37 | 40 | |
38 | -Dir[File.join(SolrPlugin.root_path, 'lib', 'ext', '*.rb')].each {|file| require_dependency file } | |
41 | +end | ... | ... |
plugins/solr/lib/solr_plugin/.search_helper.rb.swp
No preview for this file type
plugins/solr/lib/solr_plugin/search_helper.rb
... | ... | @@ -54,7 +54,7 @@ module SolrPlugin::SearchHelper |
54 | 54 | end |
55 | 55 | |
56 | 56 | def results_only? |
57 | - context.params[:action] == 'index' | |
57 | + params[:action] == 'index' | |
58 | 58 | end |
59 | 59 | |
60 | 60 | def empty_query?(query, category) |
... | ... | @@ -84,18 +84,18 @@ module SolrPlugin::SearchHelper |
84 | 84 | solr_options = {} |
85 | 85 | if !multiple_search? |
86 | 86 | if !results_only? and asset_class.respond_to? :facets |
87 | - solr_options.merge! asset_class.facets_find_options(context.params[:facet]) | |
87 | + solr_options.merge! asset_class.facets_find_options(params[:facet]) | |
88 | 88 | solr_options[:all_facets] = true |
89 | 89 | end |
90 | 90 | solr_options[:filter_queries] ||= [] |
91 | 91 | solr_options[:filter_queries] += filters(asset) |
92 | - solr_options[:filter_queries] << "environment_id:#{context.environment.id}" | |
92 | + solr_options[:filter_queries] << "environment_id:#{environment.id}" | |
93 | 93 | solr_options[:filter_queries] << asset_class.facet_category_query.call(category) if category |
94 | 94 | |
95 | 95 | solr_options[:boost_functions] ||= [] |
96 | - context.params[:order_by] = nil if context.params[:order_by] == 'none' | |
97 | - if context.params[:order_by] | |
98 | - order = SortOptions[asset][context.params[:order_by].to_sym] | |
96 | + params[:order_by] = nil if params[:order_by] == 'none' | |
97 | + if params[:order_by] | |
98 | + order = SortOptions[asset][params[:order_by].to_sym] | |
99 | 99 | raise "Unknown order by" if order.nil? |
100 | 100 | order[:solr_opts].each do |opt, value| |
101 | 101 | solr_options[opt] = value.is_a?(Proc) ? instance_eval(&value) : value | ... | ... |
plugins/solr/public/style.css
1 | 1 | .controller-search #search-column-right .search-field .formfield { |
2 | 2 | width: 594px; |
3 | - display: inline-block; | |
3 | + display: inline; | |
4 | 4 | } |
5 | 5 | |
6 | 6 | #search-column-right .search-customize-options { |
7 | - position: absolute; | |
8 | 7 | margin: 0; |
9 | 8 | padding: 5px 0; |
10 | - bottom: 0; | |
11 | - left: 0; | |
12 | 9 | } |
13 | 10 | |
14 | 11 | #search-column-right .search-results-box .vcard { | ... | ... |
plugins/solr/test/functional/.search_controller_test.rb.swp
No preview for this file type
plugins/solr/views/search/.communities.rhtml.swp
No preview for this file type
plugins/solr/views/search/.people.rhtml.swp
No preview for this file type
plugins/solr/views/search/_facets.html.erb
1 | -<% if logged_in? %> | |
2 | - <% button_bar do %> | |
3 | - <%# FIXME shouldn't the user create the community in the current environment instead of going to its home environment? %> | |
4 | - <%= button(:add, __('New community'), user.url.merge(:controller => 'memberships', :action => 'new_community', :profile => user.identifier)) if @asset == :communities %> | |
5 | - <%= button(:add, __('New enterprise'), {:controller => 'enterprise_registration'}) if @asset == :enterprises && environment.enabled?('enterprise_registration') %> | |
6 | - <% end %> | |
7 | -<% end %> | |
8 | 1 | <% if !@empty_query %> |
9 | 2 | <%= facets_menu(@asset, @facets) %> |
10 | 3 | <% end %> |
4 | + | ... | ... |
plugins/solr/views/search/search_page.html.erb
... | ... | @@ -3,17 +3,13 @@ |
3 | 3 | |
4 | 4 | <%= search_page_title( @titles[@asset], @category ) %> |
5 | 5 | |
6 | -<% if !@empty_query %> | |
7 | - <div id='search-column-left'> | |
8 | - <%= render :partial => 'facets' %> | |
9 | - </div> | |
6 | +<div id='search-column-left'> | |
7 | + <%= render :partial => 'facets' if !@empty_query %> | |
8 | +</div> | |
10 | 9 | |
11 | - <div id='search-column-right'> | |
12 | - <%= render :partial => 'results' %> | |
13 | - </div> | |
14 | -<% else %> | |
10 | +<div id='search-column-right'> | |
15 | 11 | <%= render :partial => 'results' %> |
16 | -<% end %> | |
12 | +</div> | |
17 | 13 | |
18 | 14 | <div style="clear: both"></div> |
19 | 15 | ... | ... |
plugins/spaminator/lib/spaminator_plugin/spaminator.rb
... | ... | @@ -70,17 +70,17 @@ class SpaminatorPlugin::Spaminator |
70 | 70 | self.class.log("Starting to process all comments") |
71 | 71 | comments = comments_to_process |
72 | 72 | total = comments.count |
73 | - pbar = ProgressBar.new("☢ Comments", total) | |
73 | + pbar = ProgressBar.new("☢ Comments", total) if Rails.env.development? | |
74 | 74 | comments.each do |comment| |
75 | 75 | begin |
76 | 76 | process_comment(comment) |
77 | 77 | rescue |
78 | 78 | register_fail(:comments, comment) |
79 | 79 | end |
80 | - pbar.inc | |
80 | + pbar.inc if Rails.env.development? | |
81 | 81 | end |
82 | 82 | @report.processed_comments = total |
83 | - pbar.finish | |
83 | + pbar.finish if Rails.env.development? | |
84 | 84 | self.class.log("All comments processed") |
85 | 85 | end |
86 | 86 | |
... | ... | @@ -88,14 +88,14 @@ class SpaminatorPlugin::Spaminator |
88 | 88 | self.class.log("Starting to process all people") |
89 | 89 | people = people_to_process |
90 | 90 | total = people.count |
91 | - pbar = ProgressBar.new("☢ People", total) | |
91 | + pbar = ProgressBar.new("☢ People", total) if Rails.env.development? | |
92 | 92 | people.find_each do |person| |
93 | 93 | process_person_by_comments(person) |
94 | 94 | process_person_by_no_network(person) |
95 | - pbar.inc | |
95 | + pbar.inc if Rails.env.development? | |
96 | 96 | end |
97 | 97 | @report.processed_people = total |
98 | - pbar.finish | |
98 | + pbar.finish if Rails.env.development? | |
99 | 99 | self.class.log("All people processed") |
100 | 100 | end |
101 | 101 | ... | ... |
plugins/stoa/controllers/stoa_plugin_controller.rb
... | ... | @@ -40,7 +40,7 @@ class StoaPluginController < PublicController |
40 | 40 | |
41 | 41 | def check_cpf |
42 | 42 | begin |
43 | - render :text => { :exists => !StoaPlugin::UspUser.find_by_codpes(params[:usp_id]).cpf.blank? }.to_json | |
43 | + render :text => { :exists => StoaPlugin::UspUser.find_by_codpes(params[:usp_id]).cpf.present? }.to_json | |
44 | 44 | rescue Exception => exception |
45 | 45 | render :text => { :exists => false, :error => {:message => exception.to_s, :backtrace => exception.backtrace} }.to_json |
46 | 46 | end | ... | ... |
plugins/stoa/lib/ext/person.rb
... | ... | @@ -16,7 +16,7 @@ class Person |
16 | 16 | end |
17 | 17 | |
18 | 18 | def invitation_task |
19 | - Task.pending.find(:first, :conditions => {:code => invitation_code}) || | |
20 | - Task.finished.find(:first, :conditions => {:code => invitation_code, :target_id => id}) | |
19 | + Task.pending.find(:first, :conditions => {:code => invitation_code.to_s}) || | |
20 | + Task.finished.find(:first, :conditions => {:code => invitation_code.to_s, :target_id => id}) | |
21 | 21 | end |
22 | 22 | end | ... | ... |
plugins/stoa/lib/stoa_plugin.rb
plugins/stoa/test/functional/profile_editor_controller_test.rb
... | ... | @@ -36,7 +36,7 @@ class StoaPluginProfileEditorControllerTest < ActionController::TestCase |
36 | 36 | end |
37 | 37 | |
38 | 38 | should 'not display field if profile is an organization' do |
39 | - organization = fast_create(Organization) | |
39 | + organization = fast_create(Community) | |
40 | 40 | organization.add_admin @person |
41 | 41 | get :edit, :profile => organization.identifier |
42 | 42 | assert_no_tag_in_string @response.body, :tag => 'label', :content => /USP number/, :attributes => { :for => 'usp_id_field' } | ... | ... |
plugins/stoa/test/functional/stoa_plugin_controller_test.rb
... | ... | @@ -12,27 +12,12 @@ class StoaPluginControllerTest < ActionController::TestCase |
12 | 12 | @controller = StoaPluginController.new |
13 | 13 | @request = ActionController::TestRequest.new |
14 | 14 | @response = ActionController::TestResponse.new |
15 | - @db = Tempfile.new('stoa-test') | |
16 | - configs = ActiveRecord::Base.configurations['stoa'] = {:adapter => 'sqlite3', :database => @db.path} | |
17 | - ActiveRecord::Base.establish_connection(:stoa) | |
18 | - ActiveRecord::Schema.verbose = false | |
19 | - ActiveRecord::Schema.create_table "pessoa" do |t| | |
20 | - t.integer "codpes" | |
21 | - t.text "numcpf" | |
22 | - t.date "dtanas" | |
23 | - end | |
24 | - ActiveRecord::Base.establish_connection(:test) | |
15 | + ActiveRecord::Base.configurations['stoa'] = {:adapter => 'sqlite3', :database => ':memory:', :verbosity => 'quiet'} | |
25 | 16 | env = Environment.default |
26 | 17 | env.enable_plugin(StoaPlugin.name) |
27 | 18 | env.enable('skip_new_user_email_confirmation') |
28 | 19 | env.save! |
29 | 20 | @user = create_user_full('real_user', {:password => '123456', :password_confirmation => '123456'}, {:usp_id => 9999999}) |
30 | - StoaPlugin::UspUser.create!(:codpes => 12345678, :cpf => Digest::MD5.hexdigest(SALT+'12345678'), :birth_date => '1970-01-30') | |
31 | - end | |
32 | - | |
33 | - def teardown | |
34 | - @db.unlink | |
35 | - @user.destroy | |
36 | 21 | end |
37 | 22 | |
38 | 23 | attr_accessor :user |
... | ... | @@ -70,23 +55,39 @@ class StoaPluginControllerTest < ActionController::TestCase |
70 | 55 | end |
71 | 56 | |
72 | 57 | should 'check valid usp id' do |
73 | - get :check_usp_id, :usp_id => '12345678' | |
58 | + usp_id = '12345678' | |
59 | + StoaPlugin::UspUser.stubs(:exists?).with(usp_id).returns(true) | |
60 | + get :check_usp_id, :usp_id => usp_id | |
74 | 61 | assert json_response['exists'] |
75 | 62 | end |
76 | 63 | |
77 | 64 | should 'check invalid usp id' do |
78 | - get :check_usp_id, :usp_id => '87654321' | |
65 | + usp_id = '87654321' | |
66 | + StoaPlugin::UspUser.stubs(:exists?).with(usp_id).returns(false) | |
67 | + get :check_usp_id, :usp_id => usp_id | |
79 | 68 | assert !json_response['exists'] |
80 | 69 | end |
81 | 70 | |
82 | 71 | should 'check existent cpf' do |
83 | - get :check_cpf, :usp_id => '12345678' | |
72 | + usp_id = '12345678' | |
73 | + user = mock | |
74 | + user.stubs(:cpf).returns('12345678') | |
75 | + StoaPlugin::UspUser.stubs(:find_by_codpes).with(usp_id).returns(user) | |
76 | + get :check_cpf, :usp_id => usp_id | |
84 | 77 | assert json_response['exists'] |
85 | 78 | end |
86 | 79 | |
87 | 80 | should 'check not existent cpf' do |
88 | - StoaPlugin::UspUser.create(:codpes => 87654321, :birth_date => '1970-01-30') | |
89 | - get :check_cpf, :usp_id => '87654321' | |
81 | + usp_id_with_cpf = '12345678' | |
82 | + user_with_cpf = mock | |
83 | + user_with_cpf.stubs(:cpf).returns('12345678') | |
84 | + StoaPlugin::UspUser.stubs(:find_by_codpes).with(usp_id_with_cpf).returns(user_with_cpf) | |
85 | + get :check_cpf, :usp_id => usp_id_with_cpf | |
86 | + usp_id_without_cpf = '87654321' | |
87 | + user_without_cpf = mock | |
88 | + user_with_cpf.stubs(:cpf).returns(nil) | |
89 | + StoaPlugin::UspUser.stubs(:find_by_codpes).with(usp_id_without_cpf).returns(user_without_cpf) | |
90 | + get :check_cpf, :usp_id => usp_id_without_cpf | |
90 | 91 | assert !json_response['exists'] |
91 | 92 | end |
92 | 93 | ... | ... |
... | ... | @@ -0,0 +1,13 @@ |
1 | +require_dependency 'organization' | |
2 | +class Organization | |
3 | + settings_items :sub_organizations_plugin_parent_to_be | |
4 | + | |
5 | + after_create do |organization| | |
6 | + if organization.sub_organizations_plugin_parent_to_be.present? | |
7 | + parent = Organization.find(organization.sub_organizations_plugin_parent_to_be) | |
8 | + SubOrganizationsPlugin::Relation.add_children(parent,organization) | |
9 | + end | |
10 | + end | |
11 | + | |
12 | + FIELDS << 'sub_organizations_plugin_parent_to_be' | |
13 | +end | ... | ... |
plugins/sub_organizations/lib/sub_organizations_plugin.rb
plugins/sub_organizations/lib/sub_organizations_plugin/ext/create_enterprise.rb
plugins/sub_organizations/lib/sub_organizations_plugin/ext/organization.rb
... | ... | @@ -1,13 +0,0 @@ |
1 | -require_dependency 'organization' | |
2 | -class Organization | |
3 | - settings_items :sub_organizations_plugin_parent_to_be | |
4 | - | |
5 | - after_create do |organization| | |
6 | - if organization.sub_organizations_plugin_parent_to_be.present? | |
7 | - parent = Organization.find(organization.sub_organizations_plugin_parent_to_be) | |
8 | - SubOrganizationsPlugin::Relation.add_children(parent,organization) | |
9 | - end | |
10 | - end | |
11 | - | |
12 | - FIELDS << 'sub_organizations_plugin_parent_to_be' | |
13 | -end |
plugins/tolerance_time/lib/tolerance_time_plugin.rb
plugins/work_assignment/lib/work_assignment_plugin.rb
1 | -require_dependency 'ext/uploaded_file' | |
2 | - | |
3 | 1 | class WorkAssignmentPlugin < Noosfero::Plugin |
4 | 2 | |
5 | 3 | def self.plugin_name |
... | ... | @@ -32,7 +30,9 @@ class WorkAssignmentPlugin < Noosfero::Plugin |
32 | 30 | end |
33 | 31 | |
34 | 32 | def content_remove_upload(content) |
35 | - !content.profile.members.include?(context.send(:user)) | |
33 | + if content.kind_of?(WorkAssignmentPlugin::WorkAssignment) | |
34 | + !content.profile.members.include?(context.send(:user)) | |
35 | + end | |
36 | 36 | end |
37 | 37 | |
38 | 38 | def content_viewer_controller_filters | ... | ... |