Commit 42e1b8afae156864f9634468b64d7af41b42b5b6
Exists in
master
and in
26 other branches
Merge branch 'master' into next
Showing
62 changed files
with
261 additions
and
193 deletions
Show diff stats
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
... | ... | @@ -251,8 +251,8 @@ module BoxesHelper |
251 | 251 | content_tag('h2', _('Embed block code')) + |
252 | 252 | 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;') + |
253 | 253 | content_tag('textarea', embed_code, :style => 'margin-bottom: 1em; width:100%; height:40%;', :readonly => 'readonly') + |
254 | - thickbox_close_button(_('Close')), :style => 'display: none;', :id => "embed-code-box-#{block.id}") | |
255 | - buttons << thickbox_inline_popup_icon(:embed, _('Embed code'), {}, "embed-code-box-#{block.id}") << html | |
254 | + modal_close_button(_('Close')), :style => 'display: none;', :id => "embed-code-box-#{block.id}") | |
255 | + buttons << modal_inline_icon(:embed, _('Embed code'), {}, "#embed-code-box-#{block.id}") << html | |
256 | 256 | end |
257 | 257 | |
258 | 258 | content_tag('div', buttons.join("\n") + tag('br', :style => 'clear: left'), :class => 'button-bar') | ... | ... |
app/views/features/manage_fields.html.erb
1 | 1 | <h1><%= _('Manage fields displayed for profiles') %></h1> |
2 | 2 | |
3 | +<%= javascript_include_tag "manage-fields.js" %> | |
4 | + | |
3 | 5 | <% tabs = [] %> |
4 | 6 | <% tabs << {:title => _("Person's fields"), :id => 'person-fields', |
5 | 7 | :content => (render :partial => 'manage_person_fields')} %> |
... | ... | @@ -11,5 +13,3 @@ |
11 | 13 | <% end %> |
12 | 14 | |
13 | 15 | <%= render_tabs(tabs) %> |
14 | - | |
15 | -<%= javascript_include_tag "manage-fields.js" %> | ... | ... |
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 | ... | ... |
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 | ... | ... |
plugins/google_analytics/lib/ext/profile.rb
... | ... | @@ -2,4 +2,9 @@ require_dependency 'profile' |
2 | 2 | |
3 | 3 | class Profile |
4 | 4 | settings_items :google_analytics_profile_id |
5 | + attr_accessible :google_analytics_profile_id | |
6 | + | |
7 | + descendants.each do |descendant| | |
8 | + descendant.attr_accessible :google_analytics_profile_id | |
9 | + end | |
5 | 10 | end | ... | ... |
plugins/google_analytics/lib/google_analytics_plugin.rb
... | ... | @@ -19,12 +19,15 @@ class GoogleAnalyticsPlugin < Noosfero::Plugin |
19 | 19 | |
20 | 20 | def head_ending |
21 | 21 | unless profile_id.blank? |
22 | - expanded_template('tracking-code.rhtml',{:profile_id => profile_id}) | |
22 | + expanded_template('tracking-code.html.erb',{:profile_id => profile_id}) | |
23 | 23 | end |
24 | 24 | end |
25 | 25 | |
26 | 26 | def profile_editor_extras |
27 | - expanded_template('profile-editor-extras.rhtml',{:profile_id => profile_id}) | |
27 | + analytics_id = profile_id | |
28 | + lambda { | |
29 | + render :file => 'profile-editor-extras', :locals => { :profile_id => analytics_id } | |
30 | + } | |
28 | 31 | end |
29 | 32 | |
30 | 33 | end | ... | ... |
plugins/google_analytics/test/functional/profile_editor_controller_test.rb
0 → 100644
... | ... | @@ -0,0 +1,31 @@ |
1 | +require 'test_helper' | |
2 | +require 'profile_editor_controller' | |
3 | + | |
4 | +# Re-raise errors caught by the controller. | |
5 | +class ProfileEditorController; def rescue_action(e) raise e end; end | |
6 | + | |
7 | +class ProfileEditorControllerTest < ActionController::TestCase | |
8 | + | |
9 | + def setup | |
10 | + @controller = ProfileEditorController.new | |
11 | + @request = ActionController::TestRequest.new | |
12 | + @response = ActionController::TestResponse.new | |
13 | + @profile = create_user('default_user').person | |
14 | + login_as(@profile.identifier) | |
15 | + Environment.default.enable_plugin(GoogleAnalyticsPlugin.name) | |
16 | + end | |
17 | + | |
18 | + attr_accessor :profile | |
19 | + | |
20 | + should 'add extra fields to profile editor info and settings' do | |
21 | + get :edit, :profile => profile.identifier | |
22 | + assert_tag_in_string @response.body, :tag => 'label', :content => /Google Analytics/, :attributes => { :for => 'profile_data_google_analytics_profile_id' } | |
23 | + assert_tag_in_string @response.body, :tag => 'input', :attributes => { :id => 'profile_data_google_analytics_profile_id' } | |
24 | + end | |
25 | + | |
26 | + should 'save code filled in on field' do | |
27 | + post :edit, :profile => profile.identifier, :profile_data => {:google_analytics_profile_id => 12345678} | |
28 | + assert_equal '12345678', Person.find(profile.id).google_analytics_profile_id | |
29 | + end | |
30 | + | |
31 | +end | ... | ... |
plugins/google_analytics/test/unit/google_analytics_plugin_test.rb
... | ... | @@ -27,11 +27,6 @@ class GoogleAnalyticsPluginTest < ActiveSupport::TestCase |
27 | 27 | assert_equal 'content', @plugin.head_ending |
28 | 28 | end |
29 | 29 | |
30 | - should 'add extra fields to profile editor info and settings' do | |
31 | - assert_tag_in_string @plugin.profile_editor_extras, | |
32 | - :tag => 'input', :attributes => {:id => 'profile_data_google_analytics_profile_id', :value => 10} | |
33 | - end | |
34 | - | |
35 | 30 | should 'extends Profile with attr google_analytics_profile_id' do |
36 | 31 | assert_respond_to Profile.new, :google_analytics_profile_id |
37 | 32 | end | ... | ... |
plugins/google_analytics/views/profile-editor-extras.html.erb
0 → 100644
... | ... | @@ -0,0 +1,3 @@ |
1 | +<h2><%= c_('Statistics') %></h2> | |
2 | +<%= labelled_form_field(_('Google Analytics Profile ID'), text_field(:profile_data, :google_analytics_profile_id, :value => profile_id)) %> | |
3 | +<%= link_to(_('See how to configure statistics for your profile'), '/doc/plugins/google_analytics', :target => '_blank') %> | ... | ... |
plugins/google_analytics/views/profile-editor-extras.rhtml
... | ... | @@ -1,5 +0,0 @@ |
1 | -<% extend ApplicationHelper %> | |
2 | - | |
3 | -<h2><%= c_('Statistics') %></h2> | |
4 | -<%= labelled_form_field(_('Google Analytics Profile ID'), text_field(:profile_data, :google_analytics_profile_id, :value => profile_id)) %> | |
5 | -<%= link_to(_('See how to configure statistics for your profile'), '/doc/plugins/google_analytics', :target => '_blank') %> |
... | ... | @@ -0,0 +1,9 @@ |
1 | +<script> | |
2 | + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
3 | + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
4 | + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
5 | + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | |
6 | + | |
7 | + ga('create', '<%= escape_javascript locals[:profile_id] %>', 'auto'); | |
8 | + ga('send', 'pageview'); | |
9 | +</script> | ... | ... |
plugins/google_analytics/views/tracking-code.rhtml
... | ... | @@ -1,10 +0,0 @@ |
1 | -<script type="text/javascript"> | |
2 | - var _gaq = _gaq || []; | |
3 | - _gaq.push(['_setAccount', '<%= escape_javascript locals[:profile_id] %>']); | |
4 | - _gaq.push(['_trackPageview']); | |
5 | - (function() { | |
6 | - var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
7 | - ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
8 | - var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
9 | - })(); | |
10 | -</script> |
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/send_email/controllers/send_email_plugin_base_controller.rb
... | ... | @@ -11,7 +11,8 @@ module SendEmailPluginBaseController |
11 | 11 | ) |
12 | 12 | @mail.subject = params[:subject] unless params[:subject].blank? |
13 | 13 | if @mail.valid? |
14 | - SendEmailPlugin::Sender.send_message(request.referer, @context_url, @mail).deliver | |
14 | + @referer = request.referer | |
15 | + SendEmailPlugin::Sender.send_message(@referer, @context_url, @mail).deliver | |
15 | 16 | if request.xhr? |
16 | 17 | render :text => _('Message sent') |
17 | 18 | else | ... | ... |
plugins/send_email/lib/send_email_plugin.rb
... | ... | @@ -16,9 +16,9 @@ class SendEmailPlugin < Noosfero::Plugin |
16 | 16 | |
17 | 17 | def parse_content(html, source) |
18 | 18 | if context.profile |
19 | - html.gsub!(/\{sendemail\}/, "/profile/#{context.profile.identifier}/plugin/send_email/deliver") | |
19 | + html.gsub!(/({|%7[Bb])sendemail(}|%7[Dd])/, "/profile/#{context.profile.identifier}/plugin/send_email/deliver") | |
20 | 20 | else |
21 | - html.gsub!(/\{sendemail\}/, '/plugin/send_email/deliver') | |
21 | + html.gsub!(/({|%7[Bb])sendemail(}|%7[Dd])/, '/plugin/send_email/deliver') | |
22 | 22 | end |
23 | 23 | [html, source] |
24 | 24 | end | ... | ... |
plugins/send_email/lib/send_email_plugin/mail.rb
... | ... | @@ -10,12 +10,11 @@ class SendEmailPlugin::Mail |
10 | 10 | validate :recipients_format |
11 | 11 | |
12 | 12 | def initialize(attributes = {:subject => 'New mail'}) |
13 | - @environment = attributes[:environment] | |
14 | - @from = attributes[:from] | |
15 | - @to = attributes[:to] | |
16 | - @subject = attributes[:subject] | |
17 | - @message = attributes[:message] | |
18 | - @params = attributes[:params] | |
13 | + if attributes | |
14 | + attributes.each do |attr,value| | |
15 | + self.send("#{attr}=", value) | |
16 | + end | |
17 | + end | |
19 | 18 | end |
20 | 19 | |
21 | 20 | def recipients_format |
... | ... | @@ -36,7 +35,7 @@ class SendEmailPlugin::Mail |
36 | 35 | end |
37 | 36 | |
38 | 37 | def params=(value = {}) |
39 | - [:action, :controller, :to, :message, :subject, :from].each{|k| value.delete(k)} | |
38 | + [:profile, :action, :controller, :to, :message, :subject, :from, :commit].each{|k| value.delete(k)} | |
40 | 39 | @params = value |
41 | 40 | end |
42 | 41 | ... | ... |
plugins/send_email/lib/send_email_plugin/sender.rb
... | ... | @@ -7,9 +7,9 @@ class SendEmailPlugin::Sender < Noosfero::Plugin::MailerBase |
7 | 7 | @params = mail.params |
8 | 8 | |
9 | 9 | mail( |
10 | + content_type: 'text/plain', | |
10 | 11 | to: mail.to, |
11 | 12 | from: mail.from, |
12 | - body: mail.params, | |
13 | 13 | subject: "[#{mail.environment.name}] #{mail.subject}" |
14 | 14 | ) |
15 | 15 | end | ... | ... |
plugins/send_email/test/functional/send_email_plugin_base_controller_test.rb
... | ... | @@ -54,6 +54,13 @@ def run_common_tests |
54 | 54 | post :deliver, @extra_args.merge(:to => 'john@example.com', :message => 'Hi john', :subject => 'Hello john') |
55 | 55 | assert_equal '[Colivre.net] Hello john', ActionMailer::Base.deliveries.first.subject |
56 | 56 | end |
57 | + | |
58 | + should 'deliver mail with message from view' do | |
59 | + Environment.any_instance.stubs(:send_email_plugin_allow_to).returns('john@example.com') | |
60 | + post :deliver, @extra_args.merge(:to => 'john@example.com', :message => 'Hi john', :subject => 'Hello john') | |
61 | + assert_match /Contact from/, ActionMailer::Base.deliveries.first.body.to_s | |
62 | + end | |
63 | + | |
57 | 64 | end |
58 | 65 | |
59 | 66 | class SendEmailPluginProfileControllerTest < ActionController::TestCase | ... | ... |
plugins/send_email/test/unit/send_email_plugin_sender_test.rb
... | ... | @@ -15,12 +15,14 @@ class SendEmailPluginSenderTest < ActiveSupport::TestCase |
15 | 15 | end |
16 | 16 | |
17 | 17 | should 'be able to deliver mail' do |
18 | + @mail.expects(:params).returns({}) | |
18 | 19 | response = SendEmailPlugin::Sender.send_message("http://localhost/contact", 'http//profile', @mail) |
19 | 20 | assert_equal 'noreply@localhost', response.from.join |
20 | 21 | assert_equal "[Noosfero] #{@mail.subject}", response.subject |
21 | 22 | end |
22 | 23 | |
23 | 24 | should 'deliver mail to john@example.com' do |
25 | + @mail.expects(:params).returns({}) | |
24 | 26 | response = SendEmailPlugin::Sender.send_message("http://localhost/contact", 'http//profile', @mail) |
25 | 27 | assert_equal ['john@example.com'], response.to |
26 | 28 | end | ... | ... |
plugins/send_email/test/unit/send_email_plugin_test.rb
... | ... | @@ -26,4 +26,12 @@ class SendEmailPluginTest < ActiveSupport::TestCase |
26 | 26 | assert_match /profile\/#{@plugin.context.profile.identifier}\/plugin\/send_email\/deliver/, @plugin.parse_content("expand this macro {sendemail}", nil).first |
27 | 27 | end |
28 | 28 | |
29 | + should 'expand macro used on form on profile context' do | |
30 | + profile = fast_create(Community) | |
31 | + @plugin.context.stubs(:profile).returns(profile) | |
32 | + article = RawHTMLArticle.create!(:name => 'Raw HTML', :body => "<form action='{sendemail}'></form>", :profile => profile) | |
33 | + | |
34 | + assert_match /profile\/#{profile.identifier}\/plugin\/send_email\/deliver/, @plugin.parse_content(article.to_html, nil).first | |
35 | + end | |
36 | + | |
29 | 37 | end | ... | ... |
plugins/send_email/views/send_email_plugin/sender/message.html.erb
plugins/send_email/views/send_email_plugin/sender/send_message.html.erb
0 → 100644
plugins/send_email/views/send_email_plugin/success.html.erb
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | |
3 | 3 | <table class='sendemail-plugin-message-sent'> |
4 | 4 | <tr><td class='label'><strong><%= c_('Subject') %>:</strong></td><td class='value'><em><%=h @mail.subject %></em></td></tr> |
5 | - <tr><td class='label'><strong><%= c_('Message') %>:</strong></td><td class='value'><pre><%=h render :file => 'send_email_plugin/sender/message' %></pre></td></tr> | |
5 | + <tr><td class='label'><strong><%= c_('Message') %>:</strong></td><td class='value'><pre><%=h render :file => 'send_email_plugin/sender/send_message' %></pre></td></tr> | |
6 | 6 | </table> |
7 | 7 | |
8 | 8 | <p><%= button :back, c_('Back'), :back %></p> | ... | ... |
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" | ... | ... |
public/javascripts/manage-fields.js
... | ... | @@ -57,7 +57,7 @@ jQuery(document).ready(function(){ |
57 | 57 | } |
58 | 58 | |
59 | 59 | var checkbox = jQuery(checkboxes[i+3]).attr("id").split("_") |
60 | - jQuery("#" + checkbox.first() + "_" + checkbox.last()).attr("checked", allchecked) | |
60 | + jQuery("#" + checkbox[0] + "_" + checkbox[checkbox.length-1]).attr("checked", allchecked) | |
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
... | ... | @@ -74,10 +74,10 @@ jQuery(document).ready(function(){ |
74 | 74 | |
75 | 75 | jQuery("input[type='checkbox']").click(function (){ |
76 | 76 | var checkbox = jQuery(this).attr("id").split("_") |
77 | - verify_checked(checkbox.first()) | |
77 | + verify_checked(checkbox[0]) | |
78 | 78 | |
79 | 79 | if(this.checked == false) { |
80 | - jQuery("#" + checkbox.first() + "_" + checkbox.last()).attr("checked", false) | |
80 | + jQuery("#" + checkbox[0] + "_" + checkbox[checkbox.length-1]).attr("checked", false) | |
81 | 81 | } |
82 | 82 | }) |
83 | 83 | }) | ... | ... |
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 | ... | ... |