Commit 7dba8f996a555be6c12d18dfc0695330be1461be
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
fixing conflit
Showing
46 changed files
with
176 additions
and
145 deletions
Show diff stats
.gitmodules
... | ... | @@ -19,3 +19,12 @@ |
19 | 19 | [submodule "plugins/site_tour"] |
20 | 20 | path = plugins/site_tour |
21 | 21 | url = git@gitlab.com:noosfero-plugins/site_tour.git |
22 | +[submodule "plugins/gamification"] | |
23 | + path = plugins/gamification | |
24 | + url = git@gitlab.com:noosfero-plugins/gamification.git | |
25 | +[submodule "plugins/comment_paragraph"] | |
26 | + path = plugins/comment_paragraph | |
27 | + url = git@gitlab.com:noosfero-plugins/comment-paragraph.git | |
28 | +[submodule "plugins/notification"] | |
29 | + path = plugins/notification | |
30 | + url = git@gitlab.com:noosfero-plugins/notification.git | ... | ... |
app/controllers/public/content_viewer_controller.rb
... | ... | @@ -107,10 +107,12 @@ class ContentViewerController < ApplicationController |
107 | 107 | if translation.language == locale |
108 | 108 | @page = translation |
109 | 109 | redirect_to :profile => @page.profile.identifier, :page => @page.explode_path |
110 | + return true | |
110 | 111 | end |
111 | 112 | end |
112 | 113 | end |
113 | 114 | end |
115 | + false | |
114 | 116 | end |
115 | 117 | |
116 | 118 | def pass_without_comment_captcha? | ... | ... |
app/controllers/public/events_controller.rb
... | ... | @@ -5,7 +5,11 @@ class EventsController < PublicController |
5 | 5 | |
6 | 6 | def events |
7 | 7 | @events = [] |
8 | - @date = build_date(params[:year], params[:month], params[:day]) | |
8 | + begin | |
9 | + @date = build_date params[:year], params[:month], params[:day] | |
10 | + rescue ArgumentError # invalid date | |
11 | + return render_not_found | |
12 | + end | |
9 | 13 | |
10 | 14 | if !params[:year] && !params[:month] && !params[:day] |
11 | 15 | @events = profile.events.next_events_from_month(@date).paginate(:per_page => per_page, :page => params[:page]) | ... | ... |
app/controllers/public/search_controller.rb
... | ... | @@ -62,7 +62,7 @@ class SearchController < PublicController |
62 | 62 | end |
63 | 63 | |
64 | 64 | def articles |
65 | - @scope = @environment.articles.public.paginate(paginate_options) | |
65 | + @scope = @environment.articles.public | |
66 | 66 | full_text_search |
67 | 67 | end |
68 | 68 | |
... | ... | @@ -76,7 +76,7 @@ class SearchController < PublicController |
76 | 76 | end |
77 | 77 | |
78 | 78 | def products |
79 | - @scope = @environment.products.paginate(paginate_options) | |
79 | + @scope = @environment.products | |
80 | 80 | full_text_search |
81 | 81 | end |
82 | 82 | |
... | ... | @@ -244,7 +244,7 @@ class SearchController < PublicController |
244 | 244 | def visible_profiles(klass, *extra_relations) |
245 | 245 | relations = [:image, :domains, :environment, :preferred_domain] |
246 | 246 | relations += extra_relations |
247 | - @environment.send(klass.name.underscore.pluralize).visible.includes(relations).paginate(paginate_options) | |
247 | + @environment.send(klass.name.underscore.pluralize).visible.includes(relations) | |
248 | 248 | end |
249 | 249 | |
250 | 250 | def per_page | ... | ... |
app/helpers/boxes_helper.rb
... | ... | @@ -271,7 +271,7 @@ module BoxesHelper |
271 | 271 | content_tag('div', _('Below, you''ll see a field containing embed code for the block. Just copy the code and paste it into your website or blogging software.'), :style => 'margin-bottom: 1em;') + |
272 | 272 | content_tag('textarea', embed_code, :style => 'margin-bottom: 1em; width:100%; height:40%;', :readonly => 'readonly') + |
273 | 273 | modal_close_button(_('Close')), :style => 'display: none;', :id => "embed-code-box-#{block.id}") |
274 | - buttons << modal_inline_icon(:embed, _('Embed code'), {}, "embed-code-box-#{block.id}") << html | |
274 | + buttons << modal_inline_icon(:embed, _('Embed code'), {}, "#embed-code-box-#{block.id}") << html | |
275 | 275 | end |
276 | 276 | |
277 | 277 | content_tag('div', buttons.join("\n") + tag('br', :style => 'clear: left'), :class => 'button-bar') | ... | ... |
app/views/search/search.js.erb
config/initializers/newrelic.rb
db/migrate/20140724134601_fix_yaml_encoding.rb
... | ... | @@ -18,9 +18,8 @@ class FixYamlEncoding < ActiveRecord::Migration |
18 | 18 | private |
19 | 19 | |
20 | 20 | def self.fix_encoding(model, param) |
21 | - result = model.all | |
22 | - puts "Fixing #{result.count} rows of #{model} (#{param})" | |
23 | - result.each do |r| | |
21 | + puts "Fixing #{model.count} rows of #{model} (#{param})" | |
22 | + model.find_each do |r| | |
24 | 23 | begin |
25 | 24 | yaml = r.send(param) |
26 | 25 | # if deserialization failed then a string is returned | ... | ... |
debian/changelog
features/edit_article.feature
... | ... | @@ -250,6 +250,7 @@ Feature: edit article |
250 | 250 | Scenario: add a translation to an article |
251 | 251 | Given I am on joaosilva's sitemap |
252 | 252 | And I follow "Save the whales" |
253 | + And the following languages "en es" are available on environment | |
253 | 254 | Then I should not see "Add translation" |
254 | 255 | And I follow "Edit" |
255 | 256 | And I select "English" from "Language" |
... | ... | @@ -267,6 +268,7 @@ Feature: edit article |
267 | 268 | | owner | name | language | |
268 | 269 | | joaosilva | Article in English | en | |
269 | 270 | And I am on joaosilva's sitemap |
271 | + And the following languages "en pt" are available on environment | |
270 | 272 | When I follow "Article in English" |
271 | 273 | And I follow "Add translation" |
272 | 274 | And I fill in "Title" with "Article in Portuguese" | ... | ... |
features/login.feature
... | ... | @@ -207,18 +207,3 @@ Feature: login |
207 | 207 | | Password | 123456 | |
208 | 208 | When I press "Log in" |
209 | 209 | Then I should be on joaosilva's control panel |
210 | - | |
211 | - Scenario: join community on login | |
212 | - Given the following users | |
213 | - | login | name | | |
214 | - | mariasilva | Maria Silva | | |
215 | - And the following communities | |
216 | - | name | identifier | owner | | |
217 | - | Free Software | freesoftware | mariasilva | | |
218 | - And I am on /freesoftware | |
219 | - When I follow "Join" | |
220 | - And I fill in the following: | |
221 | - | Username / Email | joaosilva | | |
222 | - | Password | 123456 | | |
223 | - And I press "Log in" | |
224 | - Then "Joao Silva" should be a member of "Free Software" | ... | ... |
features/step_definitions/internationalization_steps.rb
... | ... | @@ -22,6 +22,10 @@ Given /^Noosfero is configured to use (.+) as default$/ do |lang| |
22 | 22 | Noosfero.default_locale = language_to_code(lang) |
23 | 23 | end |
24 | 24 | |
25 | +Given /^the following languages "([^"]*)" are available on environment$/ do |languages| | |
26 | + Environment.default.update_attribute(:languages, languages.split) | |
27 | +end | |
28 | + | |
25 | 29 | After do |
26 | 30 | # reset everything back to normal |
27 | 31 | Noosfero.default_locale = nil | ... | ... |
features/step_definitions/noosfero_steps.rb
... | ... | @@ -293,6 +293,7 @@ Given /^I am logged in as "(.+)"$/ do |username| |
293 | 293 | When %{I press "Log in"} |
294 | 294 | And %{I go to #{username}'s control panel} |
295 | 295 | Then %{I should be on #{username}'s control panel} |
296 | + @current_user = username | |
296 | 297 | end |
297 | 298 | |
298 | 299 | Given /^"([^"]*)" is environment admin$/ do |person| | ... | ... |
lib/acts_as_having_image.rb
... | ... | @@ -2,7 +2,7 @@ module ActsAsHavingImage |
2 | 2 | |
3 | 3 | module ClassMethods |
4 | 4 | def acts_as_having_image |
5 | - belongs_to :image | |
5 | + belongs_to :image, dependent: :destroy | |
6 | 6 | scope :with_image, :conditions => [ "#{table_name}.image_id IS NOT NULL" ] |
7 | 7 | scope :without_image, :conditions => [ "#{table_name}.image_id IS NULL" ] |
8 | 8 | self.send(:include, ActsAsHavingImage) |
... | ... | @@ -19,4 +19,4 @@ module ActsAsHavingImage |
19 | 19 | |
20 | 20 | end |
21 | 21 | |
22 | 22 | -ActiveRecord::Base.extend(ActsAsHavingImage::ClassMethods) |
23 | +ActiveRecord::Base.extend(ActsAsHavingImage::ClassMethods) | |
23 | 24 | \ No newline at end of file | ... | ... |
lib/noosfero/version.rb
lib/tasks/plugins_tests.rake
plugins/comment_group/test/functional/comment_group_plugin_profile_controller_test.rb
... | ... | @@ -22,8 +22,9 @@ class CommentGroupPluginProfileControllerTest < ActionController::TestCase |
22 | 22 | comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :group_id => 0) |
23 | 23 | xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :group_id => 0 |
24 | 24 | assert_template 'comment_group_plugin_profile/view_comments' |
25 | - assert_match /comments_list_group_0/, @response.body | |
26 | - assert_match /\"comment-count-0\", \"1\"/, @response.body | |
25 | + assert_select_rjs '#comments_list_group_0' | |
26 | + assert_select_rjs :replace_html, '#comment-count-0' | |
27 | + assert_equal 1, assigns(:comments_count) | |
27 | 28 | end |
28 | 29 | |
29 | 30 | should 'do not show global comments' do |
... | ... | @@ -31,8 +32,9 @@ class CommentGroupPluginProfileControllerTest < ActionController::TestCase |
31 | 32 | fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :group_id => 0) |
32 | 33 | xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :group_id => 0 |
33 | 34 | assert_template 'comment_group_plugin_profile/view_comments' |
34 | - assert_match /comments_list_group_0/, @response.body | |
35 | - assert_match /\"comment-count-0\", \"1\"/, @response.body | |
35 | + assert_select_rjs '#comments_list_group_0' | |
36 | + assert_select_rjs :replace_html, '#comment-count-0' | |
37 | + assert_equal 1, assigns(:comments_count) | |
36 | 38 | end |
37 | 39 | |
38 | 40 | should 'show first page comments only' do | ... | ... |
... | ... | @@ -0,0 +1 @@ |
1 | +Subproject commit 17997821e62e31c7a4c34156bed505273e2c2579 | ... | ... |
plugins/context_content/lib/context_content_plugin/context_content_block.rb
... | ... | @@ -58,7 +58,7 @@ class ContextContentPlugin::ContextContentBlock < Block |
58 | 58 | def contents(page, p=1) |
59 | 59 | return @children unless @children.blank? |
60 | 60 | if page |
61 | - @children = page.children.with_types(types).paginate(:per_page => limit, :page => p) | |
61 | + @children = page.children.with_types(types).order(:name).paginate(:per_page => limit, :page => p) | |
62 | 62 | (@children.blank? && show_parent_content) ? contents(page.parent, p) : @children |
63 | 63 | else |
64 | 64 | nil | ... | ... |
plugins/context_content/test/unit/context_content_block_test.rb
... | ... | @@ -51,18 +51,18 @@ class ContextContentBlockTest < ActiveSupport::TestCase |
51 | 51 | should 'show contents for next page' do |
52 | 52 | @block.limit = 2 |
53 | 53 | folder = fast_create(Folder) |
54 | - article1 = fast_create(TinyMceArticle, :parent_id => folder.id) | |
55 | - article2 = fast_create(TinyMceArticle, :parent_id => folder.id) | |
56 | - article3 = fast_create(TinyMceArticle, :parent_id => folder.id) | |
54 | + article1 = fast_create(TinyMceArticle, :name => 'article 1', :parent_id => folder.id) | |
55 | + article2 = fast_create(TinyMceArticle, :name => 'article 2', :parent_id => folder.id) | |
56 | + article3 = fast_create(TinyMceArticle, :name => 'article 3', :parent_id => folder.id) | |
57 | 57 | assert_equal [article3], @block.contents(folder, 2) |
58 | 58 | end |
59 | 59 | |
60 | 60 | should 'show parent contents for next page' do |
61 | 61 | @block.limit = 2 |
62 | 62 | folder = fast_create(Folder) |
63 | - article1 = fast_create(TinyMceArticle, :parent_id => folder.id) | |
64 | - article2 = fast_create(TinyMceArticle, :parent_id => folder.id) | |
65 | - article3 = fast_create(TinyMceArticle, :parent_id => folder.id) | |
63 | + article1 = fast_create(TinyMceArticle, :name => 'article 1', :parent_id => folder.id) | |
64 | + article2 = fast_create(TinyMceArticle, :name => 'article 2', :parent_id => folder.id) | |
65 | + article3 = fast_create(TinyMceArticle, :name => 'article 3', :parent_id => folder.id) | |
66 | 66 | assert_equal [article3], @block.contents(article1, 2) |
67 | 67 | end |
68 | 68 | ... | ... |
plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb
... | ... | @@ -40,7 +40,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
40 | 40 | Article.delete_all |
41 | 41 | get :index, :block_id => block.id |
42 | 42 | json_response = ActiveSupport::JSON.decode(@response.body) |
43 | - assert_equivalent [], json_response | |
43 | + assert_equal [], json_response | |
44 | 44 | end |
45 | 45 | |
46 | 46 | should 'index action returns an json with node content' do |
... | ... | @@ -52,7 +52,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
52 | 52 | expected_json = {'data' => article.title} |
53 | 53 | expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id} |
54 | 54 | |
55 | - assert_equivalent [expected_json], json_response | |
55 | + assert_hash_equivalent [expected_json], json_response | |
56 | 56 | end |
57 | 57 | |
58 | 58 | should 'index action returns an json with node checked if the node is in the nodes list' do |
... | ... | @@ -67,7 +67,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
67 | 67 | expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id} |
68 | 68 | expected_json['attr'].merge!({'class' => 'jstree-checked'}) |
69 | 69 | |
70 | - assert_equivalent [expected_json], json_response | |
70 | + assert_hash_equivalent [expected_json], json_response | |
71 | 71 | end |
72 | 72 | |
73 | 73 | should 'index action returns an json with node undetermined if the node is in the parent nodes list' do |
... | ... | @@ -95,7 +95,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
95 | 95 | expected_json['attr'] = { 'node_id' => f.id, 'parent_id' => f.parent_id} |
96 | 96 | expected_json['state'] = 'closed' |
97 | 97 | |
98 | - assert_equivalent [expected_json], json_response | |
98 | + assert_hash_equivalent [expected_json], json_response | |
99 | 99 | end |
100 | 100 | |
101 | 101 | should 'index action returns an json with all the children nodes if some parent is in the parents list' do |
... | ... | @@ -118,7 +118,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
118 | 118 | expected_json['children'] = children |
119 | 119 | expected_json['state'] = 'closed' |
120 | 120 | |
121 | - assert_equivalent [expected_json], json_response | |
121 | + assert_hash_equivalent [expected_json], json_response | |
122 | 122 | end |
123 | 123 | |
124 | 124 | 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 |
... | ... | @@ -148,7 +148,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
148 | 148 | value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id, "class" => "jstree-checked"} |
149 | 149 | expected_json.push(value) |
150 | 150 | |
151 | - assert_equivalent expected_json, json_response | |
151 | + assert_hash_equivalent expected_json, json_response | |
152 | 152 | end |
153 | 153 | |
154 | 154 | should 'index action returns an json without children nodes if the parent is not in the parents list' do |
... | ... | @@ -170,7 +170,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase |
170 | 170 | value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id} |
171 | 171 | expected_json.push(value) |
172 | 172 | |
173 | - assert_equivalent expected_json, json_response | |
173 | + assert_hash_equivalent expected_json, json_response | |
174 | 174 | end |
175 | 175 | |
176 | 176 | 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_equivalent [], json_response | |
44 | + assert_equal [], 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_equivalent [expected_json], json_response | |
56 | + assert_hash_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_equivalent [expected_json], json_response | |
71 | + assert_hash_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 |
... | ... | @@ -97,7 +97,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
97 | 97 | expected_json['attr'] = { 'node_id' => f.id, 'parent_id' => f.parent_id} |
98 | 98 | expected_json['state'] = 'closed' |
99 | 99 | |
100 | - assert_equivalent [expected_json], json_response | |
100 | + assert_hash_equivalent [expected_json], json_response | |
101 | 101 | end |
102 | 102 | |
103 | 103 | should 'index action returns an json with all the children nodes if some parent is in the parents list' do |
... | ... | @@ -120,26 +120,26 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
120 | 120 | expected_json['children'] = children |
121 | 121 | expected_json['state'] = 'closed' |
122 | 122 | |
123 | - assert_equivalent [expected_json], json_response | |
124 | - end | |
125 | - | |
126 | - 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 | |
127 | - Article.delete_all | |
128 | - f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | |
129 | - a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) | |
130 | - a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | |
131 | - a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id) | |
132 | - block.checked_nodes = {a1.id => true} | |
133 | - block.save! | |
134 | - | |
135 | - get :index, :block_id => block.id, :profile => profile.identifier | |
136 | - json_response = ActiveSupport::JSON.decode(@response.body) | |
137 | - expected_json = [] | |
138 | - value = {'data' => f.title} | |
139 | - value['attr'] = { 'node_id' => f.id, 'parent_id' => f.parent_id} | |
140 | - children = [ | |
141 | - {'data' => a1.title, 'attr' => {'node_id' => a1.id, 'parent_id' => a1.parent_id, "class" => "jstree-checked"}}, | |
142 | - {'data' => a2.title, 'attr' => {'node_id' => a2.id, 'parent_id'=> a2.parent_id}} | |
123 | + assert_hash_equivalent [expected_json], json_response | |
124 | + end | |
125 | + | |
126 | + 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 | |
127 | + Article.delete_all | |
128 | + f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id) | |
129 | + a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id) | |
130 | + a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id) | |
131 | + a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id) | |
132 | + block.checked_nodes = {a1.id => true} | |
133 | + block.save! | |
134 | + | |
135 | + get :index, :block_id => block.id, :profile => profile.identifier | |
136 | + json_response = ActiveSupport::JSON.decode(@response.body) | |
137 | + expected_json = [] | |
138 | + value = {'data' => f.title} | |
139 | + value['attr'] = { 'node_id' => f.id, 'parent_id' => f.parent_id} | |
140 | + children = [ | |
141 | + {'data' => a1.title, 'attr' => {'node_id' => a1.id, 'parent_id' => a1.parent_id, "class" => "jstree-checked"}}, | |
142 | + {'data' => a2.title, 'attr' => {'node_id' => a2.id, 'parent_id'=> a2.parent_id}} | |
143 | 143 | ] |
144 | 144 | value['attr'].merge!({'class' => 'jstree-undetermined'}) |
145 | 145 | value['children'] = children |
... | ... | @@ -150,7 +150,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
150 | 150 | value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id} |
151 | 151 | expected_json.push(value) |
152 | 152 | |
153 | - assert_equivalent expected_json, json_response | |
153 | + assert_hash_equivalent expected_json, json_response | |
154 | 154 | end |
155 | 155 | |
156 | 156 | should 'index action returns an json without children nodes if the parent is not in the parents list' do |
... | ... | @@ -172,7 +172,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase |
172 | 172 | value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id} |
173 | 173 | expected_json.push(value) |
174 | 174 | |
175 | - assert_equivalent expected_json, json_response | |
175 | + assert_hash_equivalent expected_json, json_response | |
176 | 176 | end |
177 | 177 | |
178 | 178 | end | ... | ... |
plugins/display_content/test/test_helper.rb
1 | -require File.dirname(__FILE__) + '/../../../test/test_helper' | |
1 | +require_relative "../../../test/test_helper" | |
2 | + | |
3 | +def sort_by_data(array) | |
4 | + return if array.blank? | |
5 | + array.each {|el| el['children'] = sort_by_data(el['children']) } | |
6 | + array.sort_by {|el| el['data']} | |
7 | +end | |
8 | + | |
9 | +def assert_hash_equivalent(expected, response) | |
10 | + assert_equal sort_by_data(expected), sort_by_data(response) | |
11 | +end | ... | ... |
... | ... | @@ -0,0 +1 @@ |
1 | +Subproject commit a8aed5d9befec360868155eba1be426cee015a18 | ... | ... |
... | ... | @@ -0,0 +1 @@ |
1 | +Subproject commit 2ddc87243cea571c26eae9213e8c7d6b108bdeda | ... | ... |
plugins/pjax/public/javascripts/pjax.js
plugins/profile_description_block/test/unit/profile_description_block_test.rb
1 | 1 | require File.expand_path(File.dirname(__FILE__) + "/../../../../test/test_helper") |
2 | 2 | |
3 | 3 | class ProfileDescriptionBlockTest < ActiveSupport::TestCase |
4 | - def setup | |
5 | - e = Environment.default | |
4 | + def setup | |
5 | + e = Environment.default | |
6 | 6 | e.enabled_plugins = ['ProfileDescriptionPlugin'] |
7 | 7 | @person = create_user('test_user').person |
8 | 8 | @profile = Profile.create!(:identifier => '1236', |
9 | 9 | :name => 'blabla', |
10 | 10 | :description => "") |
11 | - end | |
11 | + end | |
12 | 12 | |
13 | 13 | should 'describe itself' do |
14 | 14 | assert_not_equal Block.description, ProfileDescriptionBlock.description |
... | ... | @@ -17,7 +17,7 @@ class ProfileDescriptionBlockTest < ActiveSupport::TestCase |
17 | 17 | should "show profile description inside block" do |
18 | 18 | new_block = ProfileDescriptionBlock.create! |
19 | 19 | @profile.boxes.first.blocks << new_block |
20 | - block_menssage = "Description field are empty" | |
20 | + block_menssage = "Description field is empty" | |
21 | 21 | assert (instance_eval(&Block.last.content).include?(block_menssage)), |
22 | 22 | "description block doesn't show not found description message" |
23 | 23 | description = "This is an test" | ... | ... |
plugins/require_auth_to_comment/features/require_auth_to_comment.feature
plugins/require_auth_to_comment/lib/ext/profile.rb
... | ... | @@ -3,4 +3,8 @@ require_dependency 'profile' |
3 | 3 | class Profile |
4 | 4 | settings_items :allow_unauthenticated_comments, :type => :boolean |
5 | 5 | attr_accessible :allow_unauthenticated_comments |
6 | + | |
7 | + descendants.each do |descendant| | |
8 | + descendant.attr_accessible :allow_unauthenticated_comments | |
9 | + end | |
6 | 10 | end | ... | ... |
plugins/stoa/lib/stoa_plugin.rb
... | ... | @@ -60,13 +60,14 @@ class StoaPlugin < Noosfero::Plugin |
60 | 60 | end |
61 | 61 | |
62 | 62 | def account_controller_filters |
63 | - block = lambda do |context| | |
63 | + block = proc do | |
64 | 64 | params[:profile_data] ||= {} |
65 | 65 | params[:profile_data][:invitation_code] = params[:invitation_code] |
66 | 66 | invitation = Task.pending.find(:first, :conditions => {:code => params[:invitation_code]}) |
67 | 67 | if request.post? |
68 | 68 | if !invitation && !StoaPlugin::UspUser.matches?(params[:profile_data][:usp_id], params[:confirmation_field], params[params[:confirmation_field]]) |
69 | - @person = Person.new(:environment => context.environment) | |
69 | + # `self` below is evaluated in the context of account_controller | |
70 | + @person = Person.new(:environment => self.environment) | |
70 | 71 | @person.errors.add(:usp_id, _(' validation failed')) |
71 | 72 | render :action => :signup |
72 | 73 | end | ... | ... |
plugins/stoa/lib/stoa_plugin/person_api.rb
... | ... | @@ -16,7 +16,7 @@ class StoaPlugin::PersonApi < Noosfero::FieldsDecorator |
16 | 16 | end |
17 | 17 | |
18 | 18 | def homepage |
19 | - context.url_for(url) | |
19 | + profile_homepage(context, object) | |
20 | 20 | end |
21 | 21 | |
22 | 22 | def birth_date |
... | ... | @@ -35,6 +35,16 @@ class StoaPlugin::PersonApi < Noosfero::FieldsDecorator |
35 | 35 | end |
36 | 36 | |
37 | 37 | def communities |
38 | - object.communities.public.map {|community| {:url => context.url_for(community.url), :name => community.name}} | |
38 | + object.communities.public.map {|community| {:url => profile_homepage(context, community), :name => community.name}} | |
39 | + end | |
40 | + | |
41 | + private | |
42 | + | |
43 | + def profile_homepage(context, profile) | |
44 | + if context.respond_to?(:url_for) | |
45 | + context.url_for(profile.url) | |
46 | + else | |
47 | + profile.environment.top_url + '/' + profile.identifier | |
48 | + end | |
39 | 49 | end |
40 | 50 | end | ... | ... |
plugins/stoa/test/functional/invite_controller_test.rb
... | ... | @@ -57,7 +57,7 @@ class InviteControllerTest < ActionController::TestCase |
57 | 57 | organization.add_admin(admin) |
58 | 58 | |
59 | 59 | login_as(admin.identifier) |
60 | - get :search_friend, :profile => organization.identifier, :q => '1234' | |
60 | + get :search, :profile => organization.identifier, :q => '1234' | |
61 | 61 | |
62 | 62 | assert_equal [{"id" => person.id, "name" => person.name}].to_json, @response.body |
63 | 63 | assert_response 200 | ... | ... |
plugins/sub_organizations/features/sub_organizations_display.feature
... | ... | @@ -29,6 +29,7 @@ Feature: sub_organizations_display |
29 | 29 | And I follow "Manage sub-groups" |
30 | 30 | And I follow "Register a new sub-enterprise" |
31 | 31 | And I fill in "Name" with "Bart" |
32 | + And I fill in "Address" with "bart" | |
32 | 33 | And I press "Next" |
33 | 34 | Then I should see "Enterprise registration completed" |
34 | 35 | And I am logged in as admin | ... | ... |
plugins/sub_organizations/lib/ext/create_enterprise.rb
po/fr/noosfero-doc.po
... | ... | @@ -7,8 +7,8 @@ msgid "" |
7 | 7 | msgstr "" |
8 | 8 | "Project-Id-Version: PACKAGE VERSION\n" |
9 | 9 | "POT-Creation-Date: 2013-12-10 15:48-0300\n" |
10 | -"PO-Revision-Date: 2015-02-23 11:33+0200\n" | |
11 | -"Last-Translator: Michal Čihař <michal@cihar.com>\n" | |
10 | +"PO-Revision-Date: 2015-03-23 19:30+0200\n" | |
11 | +"Last-Translator: Jérôme Jutteau <j.jutteau@gmail.com>\n" | |
12 | 12 | "Language-Team: French " |
13 | 13 | "<https://hosted.weblate.org/projects/noosfero/documentation/fr/>\n" |
14 | 14 | "Language: fr\n" |
... | ... | @@ -36,7 +36,7 @@ msgstr "" |
36 | 36 | #: doc/noosfero/plugins/google_cse.en.xhtml:3 |
37 | 37 | #: doc/noosfero/plugins/google_analytics.en.xhtml:3 |
38 | 38 | msgid "Usage" |
39 | -msgstr "" | |
39 | +msgstr "Utilisation" | |
40 | 40 | |
41 | 41 | # type: Content of: <ul><li> |
42 | 42 | #. type: Content of: <ul><li> |
... | ... | @@ -45,6 +45,8 @@ msgid "" |
45 | 45 | "Create a <span class=\"caps\">HTML</span> form using RawHTMLBlock or " |
46 | 46 | "RawHTMLArticle that invokes the {sendemail} action" |
47 | 47 | msgstr "" |
48 | +"Créer un formulaire <span class=\"caps\">HTML</span> utilisant RawHTMLBlock " | |
49 | +"ou RawHTMLArticle qui appel l'action {sendemail}" | |
48 | 50 | |
49 | 51 | # type: Content of: <ul><li> |
50 | 52 | #. type: Content of: <ul><li> | ... | ... |
po/it/noosfero.po
... | ... | @@ -7,7 +7,7 @@ msgid "" |
7 | 7 | msgstr "" |
8 | 8 | "Project-Id-Version: 1.0-690-gcb6e853\n" |
9 | 9 | "POT-Creation-Date: 2015-03-05 12:10-0300\n" |
10 | -"PO-Revision-Date: 2015-03-16 23:06+0200\n" | |
10 | +"PO-Revision-Date: 2015-03-23 22:59+0200\n" | |
11 | 11 | "Last-Translator: TWS <tablettws@gmail.com>\n" |
12 | 12 | "Language-Team: Italian " |
13 | 13 | "<https://hosted.weblate.org/projects/noosfero/noosfero/it/>\n" |
... | ... | @@ -6093,9 +6093,8 @@ msgid "Offline" |
6093 | 6093 | msgstr "" |
6094 | 6094 | |
6095 | 6095 | #: app/views/shared/logged_in/xmpp_chat.html.erb:60 |
6096 | -#, fuzzy | |
6097 | 6096 | msgid "Join room" |
6098 | -msgstr "Accedere" | |
6097 | +msgstr "Accedere alla stanza" | |
6099 | 6098 | |
6100 | 6099 | #: app/views/shared/logged_in/xmpp_chat.html.erb:61 |
6101 | 6100 | msgid "Leave room" | ... | ... |
po/pt/noosfero.po
... | ... | @@ -13,8 +13,8 @@ msgid "" |
13 | 13 | msgstr "" |
14 | 14 | "Project-Id-Version: 1.0-690-gcb6e853\n" |
15 | 15 | "POT-Creation-Date: 2015-03-05 12:10-0300\n" |
16 | -"PO-Revision-Date: 2015-03-17 21:44+0200\n" | |
17 | -"Last-Translator: Evandro Junior <evandrojr@gmail.com>\n" | |
16 | +"PO-Revision-Date: 2015-03-29 01:47+0200\n" | |
17 | +"Last-Translator: daniel <dtygel@eita.org.br>\n" | |
18 | 18 | "Language-Team: Portuguese " |
19 | 19 | "<https://hosted.weblate.org/projects/noosfero/noosfero/pt/>\n" |
20 | 20 | "Language: pt\n" |
... | ... | @@ -7281,7 +7281,7 @@ msgstr "Seu nome" |
7281 | 7281 | #: app/views/cms/_upload_file_form.html.erb:4 |
7282 | 7282 | #: app/views/cms/_text_editor_sidebar.html.erb:16 |
7283 | 7283 | msgid "Choose folder to upload files:" |
7284 | -msgstr "Escolha uma pasta para incluir arquivos:" | |
7284 | +msgstr "O arquivo ficará na seguinte pasta:" | |
7285 | 7285 | |
7286 | 7286 | #: app/views/cms/_upload_file_form.html.erb:16 |
7287 | 7287 | msgid "More files" |
... | ... | @@ -7535,7 +7535,7 @@ msgstr "Houve problemas com os seguintes arquivos:" |
7535 | 7535 | |
7536 | 7536 | #: app/views/cms/upload_files.html.erb:15 |
7537 | 7537 | msgid "Publish media" |
7538 | -msgstr "Publicar mídia" | |
7538 | +msgstr "Publicar imagem ou documento" | |
7539 | 7539 | |
7540 | 7540 | #: app/views/cms/upload_files.html.erb:17 |
7541 | 7541 | msgid "Select the files you want to upload (max size %s):" |
... | ... | @@ -7551,7 +7551,7 @@ msgstr "Enviando arquivos para %s" |
7551 | 7551 | |
7552 | 7552 | #: app/views/cms/_text_editor_sidebar.html.erb:8 |
7553 | 7553 | msgid "Insert media" |
7554 | -msgstr "Adicionar mídia" | |
7554 | +msgstr "Adicionar imagem ou documento" | |
7555 | 7555 | |
7556 | 7556 | #: app/views/cms/_text_editor_sidebar.html.erb:8 |
7557 | 7557 | msgid "Show/Hide" |
... | ... | @@ -7559,7 +7559,7 @@ msgstr "Mostrar/Ocultar" |
7559 | 7559 | |
7560 | 7560 | #: app/views/cms/_text_editor_sidebar.html.erb:21 |
7561 | 7561 | msgid "New folder" |
7562 | -msgstr "Nova pasta" | |
7562 | +msgstr "Criar pasta" | |
7563 | 7563 | |
7564 | 7564 | #: app/views/cms/_text_editor_sidebar.html.erb:26 |
7565 | 7565 | msgid "Hide all uploads" | ... | ... |
script/production
... | ... | @@ -85,7 +85,7 @@ environments_loop() { |
85 | 85 | } |
86 | 86 | |
87 | 87 | do_running() { |
88 | - pids=$(cat tmp/pids/thin.*.pid 2>/dev/null || true) | |
88 | + pids=$(sed "s/.*/& /" tmp/pids/thin.*.pid | tr -d '\n' 2>/dev/null || true) | |
89 | 89 | # passes if any of $pids exist, fails otherwise |
90 | 90 | kill -0 $pids > /dev/null 2>&1 |
91 | 91 | } | ... | ... |
script/quick-start
... | ... | @@ -114,7 +114,9 @@ else |
114 | 114 | rails runner 'Environment.default.enable("skip_new_user_email_confirmation")' |
115 | 115 | fi |
116 | 116 | |
117 | -run quiet rake noosfero:translations:compile | |
117 | +if [ ! -d locale ]; then | |
118 | + run quiet rake noosfero:translations:compile | |
119 | +fi | |
118 | 120 | |
119 | 121 | # create needed directory |
120 | 122 | mkdir -p tmp/pids | ... | ... |
test/functional/cms_controller_test.rb
... | ... | @@ -699,7 +699,7 @@ class CmsControllerTest < ActionController::TestCase |
699 | 699 | xhr :get, :update_categories, :profile => profile.identifier, :category_id => top.id |
700 | 700 | assert_template 'shared/update_categories' |
701 | 701 | assert_equal top, assigns(:current_category) |
702 | - assert_equal [c1, c2], assigns(:categories) | |
702 | + assert_equivalent [c1, c2], assigns(:categories) | |
703 | 703 | end |
704 | 704 | |
705 | 705 | should 'record when coming from public view on edit' do | ... | ... |
test/functional/contact_controller_test.rb
... | ... | @@ -131,7 +131,7 @@ class ContactControllerTest < ActionController::TestCase |
131 | 131 | post :new, :profile => community.identifier |
132 | 132 | |
133 | 133 | assert_response :forbidden |
134 | - assert_template :access_denied | |
134 | + assert_template :private_profile | |
135 | 135 | end |
136 | 136 | |
137 | 137 | should 'not show send e-mail page to non members of invisible community' do | ... | ... |
test/functional/events_controller_test.rb
... | ... | @@ -60,7 +60,7 @@ class EventsControllerTest < ActionController::TestCase |
60 | 60 | post :events, :profile => community.identifier |
61 | 61 | |
62 | 62 | assert_response :forbidden |
63 | - assert_template :access_denied | |
63 | + assert_template :private_profile | |
64 | 64 | end |
65 | 65 | |
66 | 66 | should 'not show events page to non members of invisible community' do | ... | ... |
test/functional/search_controller_test.rb
... | ... | @@ -204,7 +204,7 @@ class SearchControllerTest < ActionController::TestCase |
204 | 204 | end |
205 | 205 | |
206 | 206 | should 'paginate enterprise listing' do |
207 | - @controller.expects(:limit).returns(1) | |
207 | + @controller.expects(:limit).returns(1).at_least_once | |
208 | 208 | ent1 = create_profile_with_optional_category(Enterprise, 'teste 1') |
209 | 209 | ent2 = create_profile_with_optional_category(Enterprise, 'teste 2') |
210 | 210 | ... | ... |
test/integration/categories_menu_test.rb
... | ... | @@ -1,41 +0,0 @@ |
1 | -require_relative "../test_helper" | |
2 | - | |
3 | -class CategoriesMenuTest < ActionController::IntegrationTest | |
4 | - | |
5 | - def setup | |
6 | - HomeController.any_instance.stubs(:get_layout).returns('application') | |
7 | - SearchController.any_instance.stubs(:get_layout).returns('application') | |
8 | - | |
9 | - Category.delete_all | |
10 | - @cat1 = Category.create!(:display_in_menu => true, :name => 'Food', :environment => Environment.default, :display_color => '#888a85') | |
11 | - @cat2 = Category.create!(:display_in_menu => true, :name => 'Vegetables', :environment => Environment.default, :parent => @cat1) | |
12 | - | |
13 | - # all categories must be shown for these tests | |
14 | - Category.any_instance.stubs(:display_in_menu?).returns(true) | |
15 | - end | |
16 | - | |
17 | - should 'display link to categories' do | |
18 | - get '/' | |
19 | - assert_tag :attributes => { :id => 'cat_menu' }, :descendant => { :tag => 'a', :attributes => { :href => '/cat/food/vegetables' } } | |
20 | - end | |
21 | - | |
22 | - should 'display link to sub-categories' do | |
23 | - get '/cat/food' | |
24 | - # there must be a link to the subcategory | |
25 | - assert_tag :attributes => { :id => 'cat_menu' }, :descendant => { :tag => 'a', :attributes => { :href => '/cat/food/vegetables' } } | |
26 | - end | |
27 | - | |
28 | - should "always link to category's initial page in category menu" do | |
29 | - get '/search/products/food/vegetables' | |
30 | - assert_tag :attributes => { :id => 'cat_menu' }, :descendant => { :tag => 'a', :attributes => { :href => '/cat/food/vegetables' } } | |
31 | - assert_no_tag :attributes => { :id => 'cat_menu' }, :descendant => { :tag => 'a', :attributes => { :href => '/searchh/products/food/vegetables' } } | |
32 | - end | |
33 | - | |
34 | - should 'cache the categories menu' do | |
35 | - ActionController::Base.perform_caching = true | |
36 | - HomeController.any_instance.stubs(:fragment_cache_key).with(Environment.default.id.to_s + "_categories_menu").returns('dir') | |
37 | - get '/' | |
38 | - ActionController::Base.perform_caching = false | |
39 | - end | |
40 | - | |
41 | -end |
test/unit/boxes_helper_test.rb
... | ... | @@ -3,6 +3,7 @@ require 'boxes_helper' |
3 | 3 | |
4 | 4 | class BoxesHelperTest < ActionView::TestCase |
5 | 5 | |
6 | + include ApplicationHelper | |
6 | 7 | include BoxesHelper |
7 | 8 | include ActionView::Helpers::TagHelper |
8 | 9 | |
... | ... | @@ -181,4 +182,20 @@ class BoxesHelperTest < ActionView::TestCase |
181 | 182 | display_box_content(box, '') |
182 | 183 | end |
183 | 184 | |
185 | + should 'display embed button when a block is embedable' do | |
186 | + box = create(Box, position: 1, owner: fast_create(Profile)) | |
187 | + block = Block.create!(:box => box) | |
188 | + block.stubs(:embedable?).returns(true) | |
189 | + stubs(:url_for).returns('') | |
190 | + assert_tag_in_string block_edit_buttons(block), :tag => 'a', :attributes => {:class => 'button icon-button icon-embed '} | |
191 | + end | |
192 | + | |
193 | + should 'not display embed button when a block is not embedable' do | |
194 | + box = create(Box, position: 1, owner: fast_create(Profile)) | |
195 | + block = Block.create!(:box => box) | |
196 | + block.stubs(:embedable?).returns(false) | |
197 | + stubs(:url_for).returns('') | |
198 | + assert_no_tag_in_string block_edit_buttons(block), :tag => 'a', :attributes => {:class => 'button icon-button icon-embed '} | |
199 | + end | |
200 | + | |
184 | 201 | end | ... | ... |
test/unit/profile_test.rb
... | ... | @@ -110,6 +110,16 @@ class ProfileTest < ActiveSupport::TestCase |
110 | 110 | assert_equal total - mine, Article.count |
111 | 111 | end |
112 | 112 | |
113 | + should 'remove images when removing profile' do | |
114 | + profile = build(Profile, :image_builder => {:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')}) | |
115 | + image = profile.image | |
116 | + image.save! | |
117 | + profile.destroy | |
118 | + assert_raise ActiveRecord::RecordNotFound do | |
119 | + image.reload | |
120 | + end | |
121 | + end | |
122 | + | |
113 | 123 | def test_should_avoid_reserved_identifiers |
114 | 124 | Profile::RESERVED_IDENTIFIERS.each do |identifier| |
115 | 125 | assert_invalid_identifier identifier | ... | ... |