[noosfero/noosfero][next] 57 commits: Fixes for sendemail_plugin
Antonio Terceiro
gitlab at gitlab.com
Thu Apr 16 09:35:07 BRT 2015
Antonio Terceiro pushed to next at Noosfero / noosfero
Commits:
125613f4 by Daniela Feitosa at 2015-04-14T14:31:22Z
Fixes for sendemail_plugin
- Fixed email sent to users
- Removed from params info that don't need to be displayed to users on screen
and email
- Fixed replace of macro "{sendemail}"
- - - - -
a1459c79 by Antonio Terceiro at 2015-04-14T18:45:34Z
Merge branch 'sendemail_plugin' into 'master'
Fixes for sendemail_plugin
The plugin wasn't working
Fixes:
- Replaced macro "{sendemail}" by "sendemail"
* The {} is escaped on forms
- Removed from params info that don't need to be displayed to users on screen and email
- Fixed email sent to users
See merge request !547
- - - - -
12868a92 by TWS at 2015-03-23T23:41:39Z
Translated using Weblate (Italian)
Currently translated at 3.3% (68 of 2032 strings)
- - - - -
0dff4ceb by Jérôme Jutteau at 2015-03-23T20:14:58Z
Translated using Weblate (French)
Currently translated at 1.0% (10 of 911 strings)
- - - - -
8d612e1b by Eduardo Passos at 2015-03-12T12:02:15Z
Add method to destroy images from communities when a profile is removed
few image_destroy adjustments
- - - - -
cccac6a3 by Bráulio Bhavamitra at 2015-03-20T18:29:24Z
Merge branch 'image-destroy' into 'master'
Image destroy
See merge request !479
- - - - -
4e9c7fe3 by dtygel at 2015-03-22T21:18:20Z
Fix error in return values from redirect_to_translation
- - - - -
f145ca09 by Braulio Bhavamitra at 2015-03-23T11:19:24Z
pjax: fix variable reference
- - - - -
474f1f82 by Antonio Terceiro at 2015-03-23T13:36:23Z
SearchControllerTest: fix test
- - - - -
126613b1 by Antonio Terceiro at 2015-03-23T15:07:36Z
Remove integration test for deprecated layout
- - - - -
482ec131 by Antonio Terceiro at 2015-03-23T16:14:15Z
quick-start: compile translations only once
- - - - -
5121b1f2 by Weblate at 2015-03-23T20:15:09Z
Merge remote-tracking branch 'origin/master'
- - - - -
65108142 by Antonio Terceiro at 2015-03-23T19:40:32Z
Fix functional tests related to private profiles
- - - - -
577ce21b by Weblate at 2015-03-23T23:41:41Z
Merge remote-tracking branch 'origin/master'
- - - - -
365042da by Victor Costa at 2015-03-24T14:50:22Z
comment_group: fix tests
- - - - -
84904a0e by Victor Costa at 2015-03-24T15:38:47Z
Fix 'I edit my profile' step definition
Store current user to use it later in 'I edit my profile'
- - - - -
156ae506 by Victor Costa at 2015-03-24T16:33:24Z
require_auth_to_comment: fix tests
- - - - -
793f7219 by Victor Costa at 2015-03-24T17:28:07Z
display_content: fix tests
- - - - -
c4afac0b by Victor Costa at 2015-03-25T10:32:08Z
context_content: fix tests
Return children ordered by name to improve visualization and avoid test randomness.
- - - - -
450e11f4 by Victor Costa at 2015-03-25T11:09:20Z
sub_organizations: fix selenium test
- - - - -
4bf11ff9 by Larissa Reis at 2015-03-25T16:34:04Z
stoa-plugin: Fixes broken tests
- - - - -
efbaab0b by Antonio Terceiro at 2015-03-25T17:09:06Z
CmsControllerTest: remove dependency on ordering
- - - - -
59587db2 by Antonio Terceiro at 2015-03-25T17:09:06Z
features/login: remove flaky test case
I already spent quite some time in the past trying to make this test
pass and couldn't. The feature it was supposed to test actually works as
I have verified it manually, but somehow we cannot make the test to
correctly represent that.
- - - - -
6ad64bca by Braulio Bhavamitra at 2015-03-25T20:14:18Z
events: render 404 if date is invalid
- - - - -
2b67cc84 by Braulio Bhavamitra at 2015-03-25T20:25:23Z
events: add missing return on last commit
- - - - -
58eb25a9 by dtygel at 2015-03-25T21:14:58Z
Highlight correct string in form header
- - - - -
1ab07b35 by Braulio Bhavamitra at 2015-03-26T11:22:49Z
events: be specific on rescue
- - - - -
a3c427e8 by Rodrigo Souto at 2015-03-26T11:41:21Z
fix-yaml-migration: use find_each to reduce memory consumption
- - - - -
50c39865 by Rodrigo Souto at 2015-03-26T13:36:14Z
initializers: remove newrelic old way of loading
This should be done now through a custom Gemfile on config/.
Check 52bb8ba.
- - - - -
d03ee223 by Braulio Bhavamitra at 2015-03-26T22:12:06Z
searches: use replaceWith to avoid repetition
- - - - -
01024be2 by Braulio Bhavamitra at 2015-03-27T20:06:56Z
Revert "search: on crash, don't let exception load all data"
This reverts commit 82742464704b48dce6337fa31610da3db7a6bce4.
This commit broke searches pagination when using solr
- - - - -
8a3fb6f3 by Braulio Bhavamitra at 2015-03-28T09:03:04Z
plugins: only call default value if result is blank
- - - - -
da84575e by Braulio Bhavamitra at 2015-03-28T09:46:13Z
plugins: only call event on plugin if it is defined
This allow proper use of default values defined in Noosfero::Plugin
abstract class.
- - - - -
3c94729b by Braulio Bhavamitra at 2015-03-28T10:15:29Z
plugins: revert change on pipeline
- - - - -
51d3ac08 by Braulio Bhavamitra at 2015-03-28T10:44:21Z
plugins: don't crash on method_missing methods
- - - - -
c88bd7a5 by Thiago Casotti at 2015-03-30T05:11:32Z
Translated using Weblate (Portuguese (Brazil))
Currently translated at 100% (0 of 0 strings)
Created new translation.
- - - - -
81b33ca3 by daniel at 2015-03-30T05:11:33Z
Translated using Weblate (Portuguese)
Currently translated at 100.0% (2032 of 2032 strings)
- - - - -
81478cba by Braulio Bhavamitra at 2015-03-31T21:23:12Z
Revert "plugins: don't crash on method_missing methods"
This reverts commit 51d3ac08b10f2f063a6915b83e95329dd14613dd.
- - - - -
3e99a558 by Braulio Bhavamitra at 2015-03-31T21:23:12Z
Revert "plugins: revert change on pipeline"
This reverts commit 3c94729bc1231c1a23209fc6ca3aeaed5a29534d.
- - - - -
d32bf3a4 by Braulio Bhavamitra at 2015-03-31T21:23:12Z
Revert "plugins: only call event on plugin if it is defined"
This reverts commit da84575ee29154fa4f24c9acdfce9ec16a7acb5b.
- - - - -
037e6360 by Braulio Bhavamitra at 2015-03-31T21:23:12Z
Revert "plugins: only call default value if result is blank"
This reverts commit 8a3fb6f312e27c4225b95dff84ea365432e361ed.
- - - - -
97a79e39 by Antonio Terceiro at 2015-04-01T11:27:00Z
profile_description_block: fix indentation
- - - - -
8bea57ec by Antonio Terceiro at 2015-04-01T11:27:32Z
profile_description_block: fix test
- - - - -
61a8e873 by Braulio Bhavamitra at 2015-04-01T17:11:51Z
Revert "Highlight correct string in form header"
This reverts commit 58eb25a99fcea0876b1ce8da86b8605493bf6fa1.
- - - - -
48ce6083 by Rodrigo Souto at 2015-04-02T13:17:11Z
stoa: avoid url_for if not available
- - - - -
a64c82cd by Thiago Casotti at 2015-04-04T21:59:12Z
Translated using Weblate (Portuguese (Brazil))
Currently translated at 100% (0 of 0 strings)
Created new translation.
- - - - -
711c0f2d by Antonio Terceiro at 2015-04-04T21:07:56Z
Noosfero 1.1~rc4
- - - - -
d0bafea0 by Antonio Terceiro at 2015-04-04T21:09:12Z
Remove pt_BR; as of now pt *is* Brazilian Portuguese
- - - - -
ef9d58aa by Victor Costa at 2015-04-06T13:36:55Z
Fix selenium tests related to article edition
- - - - -
1948d92c by Rodrigo Souto at 2015-04-07T16:23:01Z
script-production: add spaces between pids on running method
- - - - -
886d362a by Antonio Terceiro at 2015-04-08T06:58:33Z
Merge branch 'running-check' into 'master'
script-production: add spaces between pids on running method
The method `running` o script production was concatenating all pids without spaces.
See merge request !539
- - - - -
b501e2ce by Victor Costa at 2015-04-08T12:08:02Z
Fix embed button in boxes helper
- - - - -
9fd165ce by Daniela Feitosa at 2015-04-14T15:33:30Z
fixes for google_analytics_plugin
- allow mass-assignment
- Replaced .rhtml by .html.erb
- updated script code
- - - - -
20d51a81 by Antonio Terceiro at 2015-04-14T19:16:33Z
Merge branch 'ga_plugin' into 'master'
fixes for google_analytics_plugin
The plugin wasn't working
Fixes:
- allow mass-assignment
- Replaced .rhtml by .html.erb
- updated script code
See merge request !544
- - - - -
c5339c76 by Daniela Feitosa at 2015-04-14T23:18:06Z
sendemail_plugin: defined content_type for email
Also removed "profile" param from confirmation view and email
- - - - -
9082d6c1 by Antonio Terceiro at 2015-04-15T12:33:16Z
manage_field: fix Javascript
I am pretty sure that those calls to .first() an .last() on Javascript
arrays never worked at all.
- - - - -
42e1b8af by Antonio Terceiro at 2015-04-16T09:35:16Z
Merge branch 'master' into next
- - - - -
60 changed files:
- app/controllers/public/content_viewer_controller.rb
- app/controllers/public/events_controller.rb
- app/controllers/public/search_controller.rb
- app/helpers/boxes_helper.rb
- app/views/features/manage_fields.html.erb
- app/views/search/search.js.erb
- − config/initializers/newrelic.rb
- db/migrate/20140724134601_fix_yaml_encoding.rb
- debian/changelog
- features/edit_article.feature
- features/login.feature
- features/step_definitions/internationalization_steps.rb
- features/step_definitions/noosfero_steps.rb
- lib/acts_as_having_image.rb
- lib/noosfero/version.rb
- lib/tasks/plugins_tests.rake
- plugins/comment_group/test/functional/comment_group_plugin_profile_controller_test.rb
- plugins/context_content/lib/context_content_plugin/context_content_block.rb
- plugins/context_content/test/unit/context_content_block_test.rb
- plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb
- plugins/display_content/test/functional/display_content_plugin_myprofile_controller_test.rb
- plugins/display_content/test/test_helper.rb
- plugins/google_analytics/lib/ext/profile.rb
- plugins/google_analytics/lib/google_analytics_plugin.rb
- + plugins/google_analytics/test/functional/profile_editor_controller_test.rb
- plugins/google_analytics/test/unit/google_analytics_plugin_test.rb
- plugins/google_analytics/views/profile-editor-extras.rhtml → plugins/google_analytics/views/profile-editor-extras.html.erb
- + plugins/google_analytics/views/tracking-code.html.erb
- − plugins/google_analytics/views/tracking-code.rhtml
- plugins/pjax/public/javascripts/pjax.js
- plugins/profile_description_block/test/unit/profile_description_block_test.rb
- plugins/require_auth_to_comment/features/require_auth_to_comment.feature
- plugins/require_auth_to_comment/lib/ext/profile.rb
- plugins/send_email/controllers/send_email_plugin_base_controller.rb
- plugins/send_email/lib/send_email_plugin.rb
- plugins/send_email/lib/send_email_plugin/mail.rb
- plugins/send_email/lib/send_email_plugin/sender.rb
- plugins/send_email/test/functional/send_email_plugin_base_controller_test.rb
- plugins/send_email/test/unit/send_email_plugin_sender_test.rb
- plugins/send_email/test/unit/send_email_plugin_test.rb
- plugins/send_email/views/send_email_plugin/sender/message.html.erb → plugins/send_email/views/send_email_plugin/sender/send_message.html.erb
- plugins/send_email/views/send_email_plugin/success.html.erb
- plugins/stoa/lib/stoa_plugin.rb
- plugins/stoa/lib/stoa_plugin/person_api.rb
- plugins/stoa/test/functional/invite_controller_test.rb
- plugins/sub_organizations/features/sub_organizations_display.feature
- plugins/sub_organizations/lib/ext/create_enterprise.rb
- po/fr/noosfero-doc.po
- po/it/noosfero.po
- po/pt/noosfero.po
- public/javascripts/manage-fields.js
- script/production
- script/quick-start
- test/functional/cms_controller_test.rb
- test/functional/contact_controller_test.rb
- test/functional/events_controller_test.rb
- test/functional/search_controller_test.rb
- − test/integration/categories_menu_test.rb
- test/unit/boxes_helper_test.rb
- test/unit/profile_test.rb
Changes:
=====================================
app/controllers/public/content_viewer_controller.rb
=====================================
--- a/app/controllers/public/content_viewer_controller.rb
+++ b/app/controllers/public/content_viewer_controller.rb
@@ -107,10 +107,12 @@ class ContentViewerController < ApplicationController
if translation.language == locale
@page = translation
redirect_to :profile => @page.profile.identifier, :page => @page.explode_path
+ return true
end
end
end
end
+ false
end
def pass_without_comment_captcha?
=====================================
app/controllers/public/events_controller.rb
=====================================
--- a/app/controllers/public/events_controller.rb
+++ b/app/controllers/public/events_controller.rb
@@ -5,7 +5,11 @@ class EventsController < PublicController
def events
@events = []
- @date = build_date(params[:year], params[:month], params[:day])
+ begin
+ @date = build_date params[:year], params[:month], params[:day]
+ rescue ArgumentError # invalid date
+ return render_not_found
+ end
if !params[:year] && !params[:month] && !params[:day]
@events = profile.events.next_events_from_month(@date).paginate(:per_page => per_page, :page => params[:page])
=====================================
app/controllers/public/search_controller.rb
=====================================
--- a/app/controllers/public/search_controller.rb
+++ b/app/controllers/public/search_controller.rb
@@ -62,7 +62,7 @@ class SearchController < PublicController
end
def articles
- @scope = @environment.articles.public.paginate(paginate_options)
+ @scope = @environment.articles.public
full_text_search
end
@@ -76,7 +76,7 @@ class SearchController < PublicController
end
def products
- @scope = @environment.products.paginate(paginate_options)
+ @scope = @environment.products
full_text_search
end
@@ -244,7 +244,7 @@ class SearchController < PublicController
def visible_profiles(klass, *extra_relations)
relations = [:image, :domains, :environment, :preferred_domain]
relations += extra_relations
- @environment.send(klass.name.underscore.pluralize).visible.includes(relations).paginate(paginate_options)
+ @environment.send(klass.name.underscore.pluralize).visible.includes(relations)
end
def per_page
=====================================
app/helpers/boxes_helper.rb
=====================================
--- a/app/helpers/boxes_helper.rb
+++ b/app/helpers/boxes_helper.rb
@@ -251,8 +251,8 @@ module BoxesHelper
content_tag('h2', _('Embed block code')) +
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;') +
content_tag('textarea', embed_code, :style => 'margin-bottom: 1em; width:100%; height:40%;', :readonly => 'readonly') +
- thickbox_close_button(_('Close')), :style => 'display: none;', :id => "embed-code-box-#{block.id}")
- buttons << thickbox_inline_popup_icon(:embed, _('Embed code'), {}, "embed-code-box-#{block.id}") << html
+ modal_close_button(_('Close')), :style => 'display: none;', :id => "embed-code-box-#{block.id}")
+ buttons << modal_inline_icon(:embed, _('Embed code'), {}, "#embed-code-box-#{block.id}") << html
end
content_tag('div', buttons.join("\n") + tag('br', :style => 'clear: left'), :class => 'button-bar')
=====================================
app/views/features/manage_fields.html.erb
=====================================
--- a/app/views/features/manage_fields.html.erb
+++ b/app/views/features/manage_fields.html.erb
@@ -1,5 +1,7 @@
<h1><%= _('Manage fields displayed for profiles') %></h1>
+<%= javascript_include_tag "manage-fields.js" %>
+
<% tabs = [] %>
<% tabs << {:title => _("Person's fields"), :id => 'person-fields',
:content => (render :partial => 'manage_person_fields')} %>
@@ -11,5 +13,3 @@
<% end %>
<%= render_tabs(tabs) %>
-
-<%= javascript_include_tag "manage-fields.js" %>
=====================================
app/views/search/search.js.erb
=====================================
--- a/app/views/search/search.js.erb
+++ b/app/views/search/search.js.erb
@@ -1 +1,2 @@
-jQuery('#search-content').html('<%= escape_javascript(render :partial => "search_content") %>');
+jQuery('#search-content').replaceWith('<%= escape_javascript(render "search_content") %>');
+
=====================================
config/initializers/newrelic.rb deleted
=====================================
--- a/config/initializers/newrelic.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-# Load newrelic agent if its config file is defined.
-require 'newrelic_rpm' if File.exist?(File.dirname(__FILE__) + '/../newrelic.yml')
=====================================
db/migrate/20140724134601_fix_yaml_encoding.rb
=====================================
--- a/db/migrate/20140724134601_fix_yaml_encoding.rb
+++ b/db/migrate/20140724134601_fix_yaml_encoding.rb
@@ -18,9 +18,8 @@ class FixYamlEncoding < ActiveRecord::Migration
private
def self.fix_encoding(model, param)
- result = model.all
- puts "Fixing #{result.count} rows of #{model} (#{param})"
- result.each do |r|
+ puts "Fixing #{model.count} rows of #{model} (#{param})"
+ model.find_each do |r|
begin
yaml = r.send(param)
# if deserialization failed then a string is returned
=====================================
debian/changelog
=====================================
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+noosfero (1.1~rc4) wheezy; urgency=medium
+
+ * Fourth release candidate for Noosfero 1.1
+
+ -- Antonio Terceiro <terceiro at debian.org> Wed, 01 Apr 2015 12:22:36 -0300
+
noosfero (1.1~rc2) wheezy; urgency=low
* Second release candidate for Noosfero 1.1
=====================================
features/edit_article.feature
=====================================
--- a/features/edit_article.feature
+++ b/features/edit_article.feature
@@ -250,6 +250,7 @@ Feature: edit article
Scenario: add a translation to an article
Given I am on joaosilva's sitemap
And I follow "Save the whales"
+ And the following languages "en es" are available on environment
Then I should not see "Add translation"
And I follow "Edit"
And I select "English" from "Language"
@@ -267,6 +268,7 @@ Feature: edit article
| owner | name | language |
| joaosilva | Article in English | en |
And I am on joaosilva's sitemap
+ And the following languages "en pt" are available on environment
When I follow "Article in English"
And I follow "Add translation"
And I fill in "Title" with "Article in Portuguese"
=====================================
features/login.feature
=====================================
--- a/features/login.feature
+++ b/features/login.feature
@@ -207,18 +207,3 @@ Feature: login
| Password | 123456 |
When I press "Log in"
Then I should be on joaosilva's control panel
-
- Scenario: join community on login
- Given the following users
- | login | name |
- | mariasilva | Maria Silva |
- And the following communities
- | name | identifier | owner |
- | Free Software | freesoftware | mariasilva |
- And I am on /freesoftware
- When I follow "Join"
- And I fill in the following:
- | Username / Email | joaosilva |
- | Password | 123456 |
- And I press "Log in"
- Then "Joao Silva" should be a member of "Free Software"
=====================================
features/step_definitions/internationalization_steps.rb
=====================================
--- a/features/step_definitions/internationalization_steps.rb
+++ b/features/step_definitions/internationalization_steps.rb
@@ -22,6 +22,10 @@ Given /^Noosfero is configured to use (.+) as default$/ do |lang|
Noosfero.default_locale = language_to_code(lang)
end
+Given /^the following languages "([^"]*)" are available on environment$/ do |languages|
+ Environment.default.update_attribute(:languages, languages.split)
+end
+
After do
# reset everything back to normal
Noosfero.default_locale = nil
=====================================
features/step_definitions/noosfero_steps.rb
=====================================
--- a/features/step_definitions/noosfero_steps.rb
+++ b/features/step_definitions/noosfero_steps.rb
@@ -293,6 +293,7 @@ Given /^I am logged in as "(.+)"$/ do |username|
When %{I press "Log in"}
And %{I go to #{username}'s control panel}
Then %{I should be on #{username}'s control panel}
+ @current_user = username
end
Given /^"([^"]*)" is environment admin$/ do |person|
=====================================
lib/acts_as_having_image.rb
=====================================
--- a/lib/acts_as_having_image.rb
+++ b/lib/acts_as_having_image.rb
@@ -2,7 +2,7 @@ module ActsAsHavingImage
module ClassMethods
def acts_as_having_image
- belongs_to :image
+ belongs_to :image, dependent: :destroy
scope :with_image, :conditions => [ "#{table_name}.image_id IS NOT NULL" ]
scope :without_image, :conditions => [ "#{table_name}.image_id IS NULL" ]
self.send(:include, ActsAsHavingImage)
@@ -19,4 +19,4 @@ module ActsAsHavingImage
end
-ActiveRecord::Base.extend(ActsAsHavingImage::ClassMethods)
+ActiveRecord::Base.extend(ActsAsHavingImage::ClassMethods)
\ No newline at end of file
=====================================
lib/noosfero/version.rb
=====================================
--- a/lib/noosfero/version.rb
+++ b/lib/noosfero/version.rb
@@ -1,6 +1,6 @@
module Noosfero
PROJECT = 'noosfero'
- VERSION = '1.1~rc2'
+ VERSION = '1.1~rc4'
end
root = File.expand_path(File.dirname(__FILE__) + '/../..')
=====================================
lib/tasks/plugins_tests.rake
=====================================
--- a/lib/tasks/plugins_tests.rake
+++ b/lib/tasks/plugins_tests.rake
@@ -4,7 +4,6 @@ $broken_plugins = %w[
comment_classification
ldap
solr
- stoa
]
@all_plugins = Dir.glob('plugins/*').map { |f| File.basename(f) } - ['template']
=====================================
plugins/comment_group/test/functional/comment_group_plugin_profile_controller_test.rb
=====================================
--- a/plugins/comment_group/test/functional/comment_group_plugin_profile_controller_test.rb
+++ b/plugins/comment_group/test/functional/comment_group_plugin_profile_controller_test.rb
@@ -22,8 +22,9 @@ class CommentGroupPluginProfileControllerTest < ActionController::TestCase
comment = fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :group_id => 0)
xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :group_id => 0
assert_template 'comment_group_plugin_profile/view_comments'
- assert_match /comments_list_group_0/, @response.body
- assert_match /\"comment-count-0\", \"1\"/, @response.body
+ assert_select_rjs '#comments_list_group_0'
+ assert_select_rjs :replace_html, '#comment-count-0'
+ assert_equal 1, assigns(:comments_count)
end
should 'do not show global comments' do
@@ -31,8 +32,9 @@ class CommentGroupPluginProfileControllerTest < ActionController::TestCase
fast_create(Comment, :source_id => article, :author_id => profile, :title => 'a comment', :body => 'lalala', :group_id => 0)
xhr :get, :view_comments, :profile => @profile.identifier, :article_id => article.id, :group_id => 0
assert_template 'comment_group_plugin_profile/view_comments'
- assert_match /comments_list_group_0/, @response.body
- assert_match /\"comment-count-0\", \"1\"/, @response.body
+ assert_select_rjs '#comments_list_group_0'
+ assert_select_rjs :replace_html, '#comment-count-0'
+ assert_equal 1, assigns(:comments_count)
end
should 'show first page comments only' do
=====================================
plugins/context_content/lib/context_content_plugin/context_content_block.rb
=====================================
--- a/plugins/context_content/lib/context_content_plugin/context_content_block.rb
+++ b/plugins/context_content/lib/context_content_plugin/context_content_block.rb
@@ -58,7 +58,7 @@ class ContextContentPlugin::ContextContentBlock < Block
def contents(page, p=1)
return @children unless @children.blank?
if page
- @children = page.children.with_types(types).paginate(:per_page => limit, :page => p)
+ @children = page.children.with_types(types).order(:name).paginate(:per_page => limit, :page => p)
(@children.blank? && show_parent_content) ? contents(page.parent, p) : @children
else
nil
=====================================
plugins/context_content/test/unit/context_content_block_test.rb
=====================================
--- a/plugins/context_content/test/unit/context_content_block_test.rb
+++ b/plugins/context_content/test/unit/context_content_block_test.rb
@@ -51,18 +51,18 @@ class ContextContentBlockTest < ActiveSupport::TestCase
should 'show contents for next page' do
@block.limit = 2
folder = fast_create(Folder)
- article1 = fast_create(TinyMceArticle, :parent_id => folder.id)
- article2 = fast_create(TinyMceArticle, :parent_id => folder.id)
- article3 = fast_create(TinyMceArticle, :parent_id => folder.id)
+ article1 = fast_create(TinyMceArticle, :name => 'article 1', :parent_id => folder.id)
+ article2 = fast_create(TinyMceArticle, :name => 'article 2', :parent_id => folder.id)
+ article3 = fast_create(TinyMceArticle, :name => 'article 3', :parent_id => folder.id)
assert_equal [article3], @block.contents(folder, 2)
end
should 'show parent contents for next page' do
@block.limit = 2
folder = fast_create(Folder)
- article1 = fast_create(TinyMceArticle, :parent_id => folder.id)
- article2 = fast_create(TinyMceArticle, :parent_id => folder.id)
- article3 = fast_create(TinyMceArticle, :parent_id => folder.id)
+ article1 = fast_create(TinyMceArticle, :name => 'article 1', :parent_id => folder.id)
+ article2 = fast_create(TinyMceArticle, :name => 'article 2', :parent_id => folder.id)
+ article3 = fast_create(TinyMceArticle, :name => 'article 3', :parent_id => folder.id)
assert_equal [article3], @block.contents(article1, 2)
end
=====================================
plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb
=====================================
--- a/plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb
+++ b/plugins/display_content/test/functional/display_content_plugin_admin_controller_test.rb
@@ -40,7 +40,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase
Article.delete_all
get :index, :block_id => block.id
json_response = ActiveSupport::JSON.decode(@response.body)
- assert_equivalent [], json_response
+ assert_equal [], json_response
end
should 'index action returns an json with node content' do
@@ -52,7 +52,7 @@ class DisplayContentPluginAdminControllerTest < ActionController::TestCase
expected_json = {'data' => article.title}
expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id}
- assert_equivalent [expected_json], json_response
+ assert_hash_equivalent [expected_json], json_response
end
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
expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id}
expected_json['attr'].merge!({'class' => 'jstree-checked'})
- assert_equivalent [expected_json], json_response
+ assert_hash_equivalent [expected_json], json_response
end
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
expected_json['attr'] = { 'node_id' => f.id, 'parent_id' => f.parent_id}
expected_json['state'] = 'closed'
- assert_equivalent [expected_json], json_response
+ assert_hash_equivalent [expected_json], json_response
end
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
expected_json['children'] = children
expected_json['state'] = 'closed'
- assert_equivalent [expected_json], json_response
+ assert_hash_equivalent [expected_json], json_response
end
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
value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id, "class" => "jstree-checked"}
expected_json.push(value)
- assert_equivalent expected_json, json_response
+ assert_hash_equivalent expected_json, json_response
end
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
value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id}
expected_json.push(value)
- assert_equivalent expected_json, json_response
+ assert_hash_equivalent expected_json, json_response
end
end
=====================================
plugins/display_content/test/functional/display_content_plugin_myprofile_controller_test.rb
=====================================
--- a/plugins/display_content/test/functional/display_content_plugin_myprofile_controller_test.rb
+++ b/plugins/display_content/test/functional/display_content_plugin_myprofile_controller_test.rb
@@ -41,7 +41,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase
Article.delete_all
get :index, :block_id => block.id, :profile => profile.identifier
json_response = ActiveSupport::JSON.decode(@response.body)
- assert_equivalent [], json_response
+ assert_equal [], json_response
end
should 'index action returns an json with node content' do
@@ -53,7 +53,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase
expected_json = {'data' => article.title}
expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id}
- assert_equivalent [expected_json], json_response
+ assert_hash_equivalent [expected_json], json_response
end
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
expected_json['attr'] = { 'node_id' => article.id, 'parent_id' => article.parent_id}
expected_json['attr'].merge!({'class' => 'jstree-checked'})
- assert_equivalent [expected_json], json_response
+ assert_hash_equivalent [expected_json], json_response
end
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
expected_json['attr'] = { 'node_id' => f.id, 'parent_id' => f.parent_id}
expected_json['state'] = 'closed'
- assert_equivalent [expected_json], json_response
+ assert_hash_equivalent [expected_json], json_response
end
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
expected_json['children'] = children
expected_json['state'] = 'closed'
- assert_equivalent [expected_json], json_response
- end
-
- 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
- Article.delete_all
- f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id)
- a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id)
- a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id)
- a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id)
- block.checked_nodes = {a1.id => true}
- block.save!
-
- get :index, :block_id => block.id, :profile => profile.identifier
- json_response = ActiveSupport::JSON.decode(@response.body)
- expected_json = []
- value = {'data' => f.title}
- value['attr'] = { 'node_id' => f.id, 'parent_id' => f.parent_id}
- children = [
- {'data' => a1.title, 'attr' => {'node_id' => a1.id, 'parent_id' => a1.parent_id, "class" => "jstree-checked"}},
- {'data' => a2.title, 'attr' => {'node_id' => a2.id, 'parent_id'=> a2.parent_id}}
+ assert_hash_equivalent [expected_json], json_response
+ end
+
+ 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
+ Article.delete_all
+ f = fast_create(Folder, :name => 'test folder 1', :profile_id => profile.id)
+ a1 = fast_create(TextileArticle, :name => 'test article 1', :profile_id => profile.id, :parent_id => f.id)
+ a2 = fast_create(TextileArticle, :name => 'test article 2', :profile_id => profile.id, :parent_id => f.id)
+ a3 = fast_create(TextileArticle, :name => 'test article 3', :profile_id => profile.id)
+ block.checked_nodes = {a1.id => true}
+ block.save!
+
+ get :index, :block_id => block.id, :profile => profile.identifier
+ json_response = ActiveSupport::JSON.decode(@response.body)
+ expected_json = []
+ value = {'data' => f.title}
+ value['attr'] = { 'node_id' => f.id, 'parent_id' => f.parent_id}
+ children = [
+ {'data' => a1.title, 'attr' => {'node_id' => a1.id, 'parent_id' => a1.parent_id, "class" => "jstree-checked"}},
+ {'data' => a2.title, 'attr' => {'node_id' => a2.id, 'parent_id'=> a2.parent_id}}
]
value['attr'].merge!({'class' => 'jstree-undetermined'})
value['children'] = children
@@ -150,7 +150,7 @@ class DisplayContentPluginMyprofileControllerTest < ActionController::TestCase
value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id}
expected_json.push(value)
- assert_equivalent expected_json, json_response
+ assert_hash_equivalent expected_json, json_response
end
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
value['attr'] = { 'node_id' => a3.id, 'parent_id' => a3.parent_id}
expected_json.push(value)
- assert_equivalent expected_json, json_response
+ assert_hash_equivalent expected_json, json_response
end
end
=====================================
plugins/display_content/test/test_helper.rb
=====================================
--- a/plugins/display_content/test/test_helper.rb
+++ b/plugins/display_content/test/test_helper.rb
@@ -1 +1,11 @@
-require File.dirname(__FILE__) + '/../../../test/test_helper'
+require_relative "../../../test/test_helper"
+
+def sort_by_data(array)
+ return if array.blank?
+ array.each {|el| el['children'] = sort_by_data(el['children']) }
+ array.sort_by {|el| el['data']}
+end
+
+def assert_hash_equivalent(expected, response)
+ assert_equal sort_by_data(expected), sort_by_data(response)
+end
=====================================
plugins/google_analytics/lib/ext/profile.rb
=====================================
--- a/plugins/google_analytics/lib/ext/profile.rb
+++ b/plugins/google_analytics/lib/ext/profile.rb
@@ -2,4 +2,9 @@ require_dependency 'profile'
class Profile
settings_items :google_analytics_profile_id
+ attr_accessible :google_analytics_profile_id
+
+ descendants.each do |descendant|
+ descendant.attr_accessible :google_analytics_profile_id
+ end
end
=====================================
plugins/google_analytics/lib/google_analytics_plugin.rb
=====================================
--- a/plugins/google_analytics/lib/google_analytics_plugin.rb
+++ b/plugins/google_analytics/lib/google_analytics_plugin.rb
@@ -19,12 +19,15 @@ class GoogleAnalyticsPlugin < Noosfero::Plugin
def head_ending
unless profile_id.blank?
- expanded_template('tracking-code.rhtml',{:profile_id => profile_id})
+ expanded_template('tracking-code.html.erb',{:profile_id => profile_id})
end
end
def profile_editor_extras
- expanded_template('profile-editor-extras.rhtml',{:profile_id => profile_id})
+ analytics_id = profile_id
+ lambda {
+ render :file => 'profile-editor-extras', :locals => { :profile_id => analytics_id }
+ }
end
end
=====================================
plugins/google_analytics/test/functional/profile_editor_controller_test.rb
=====================================
--- /dev/null
+++ b/plugins/google_analytics/test/functional/profile_editor_controller_test.rb
@@ -0,0 +1,31 @@
+require 'test_helper'
+require 'profile_editor_controller'
+
+# Re-raise errors caught by the controller.
+class ProfileEditorController; def rescue_action(e) raise e end; end
+
+class ProfileEditorControllerTest < ActionController::TestCase
+
+ def setup
+ @controller = ProfileEditorController.new
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ @profile = create_user('default_user').person
+ login_as(@profile.identifier)
+ Environment.default.enable_plugin(GoogleAnalyticsPlugin.name)
+ end
+
+ attr_accessor :profile
+
+ should 'add extra fields to profile editor info and settings' do
+ get :edit, :profile => profile.identifier
+ assert_tag_in_string @response.body, :tag => 'label', :content => /Google Analytics/, :attributes => { :for => 'profile_data_google_analytics_profile_id' }
+ assert_tag_in_string @response.body, :tag => 'input', :attributes => { :id => 'profile_data_google_analytics_profile_id' }
+ end
+
+ should 'save code filled in on field' do
+ post :edit, :profile => profile.identifier, :profile_data => {:google_analytics_profile_id => 12345678}
+ assert_equal '12345678', Person.find(profile.id).google_analytics_profile_id
+ end
+
+end
=====================================
plugins/google_analytics/test/unit/google_analytics_plugin_test.rb
=====================================
--- a/plugins/google_analytics/test/unit/google_analytics_plugin_test.rb
+++ b/plugins/google_analytics/test/unit/google_analytics_plugin_test.rb
@@ -27,11 +27,6 @@ class GoogleAnalyticsPluginTest < ActiveSupport::TestCase
assert_equal 'content', @plugin.head_ending
end
- should 'add extra fields to profile editor info and settings' do
- assert_tag_in_string @plugin.profile_editor_extras,
- :tag => 'input', :attributes => {:id => 'profile_data_google_analytics_profile_id', :value => 10}
- end
-
should 'extends Profile with attr google_analytics_profile_id' do
assert_respond_to Profile.new, :google_analytics_profile_id
end
=====================================
plugins/google_analytics/views/profile-editor-extras.rhtml → plugins/google_analytics/views/profile-editor-extras.html.erb
=====================================
--- a/plugins/google_analytics/views/profile-editor-extras.rhtml
+++ b/plugins/google_analytics/views/profile-editor-extras.html.erb
@@ -1,5 +1,3 @@
-<% extend ApplicationHelper %>
-
<h2><%= c_('Statistics') %></h2>
<%= labelled_form_field(_('Google Analytics Profile ID'), text_field(:profile_data, :google_analytics_profile_id, :value => profile_id)) %>
<%= link_to(_('See how to configure statistics for your profile'), '/doc/plugins/google_analytics', :target => '_blank') %>
=====================================
plugins/google_analytics/views/tracking-code.html.erb
=====================================
--- /dev/null
+++ b/plugins/google_analytics/views/tracking-code.html.erb
@@ -0,0 +1,9 @@
+<script>
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+ ga('create', '<%= escape_javascript locals[:profile_id] %>', 'auto');
+ ga('send', 'pageview');
+</script>
=====================================
plugins/google_analytics/views/tracking-code.rhtml deleted
=====================================
--- a/plugins/google_analytics/views/tracking-code.rhtml
+++ /dev/null
@@ -1,10 +0,0 @@
-<script type="text/javascript">
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', '<%= escape_javascript locals[:profile_id] %>']);
- _gaq.push(['_trackPageview']);
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
-</script>
=====================================
plugins/pjax/public/javascripts/pjax.js
=====================================
--- a/plugins/pjax/public/javascripts/pjax.js
+++ b/plugins/pjax/public/javascripts/pjax.js
@@ -157,7 +157,7 @@ pjax = {
document._write = document.write;
document.write = function (data) {
if (document.readyState != 'loading')
- content.append(data);
+ pjax.content.append(data);
else
document._write(data);
};
=====================================
plugins/profile_description_block/test/unit/profile_description_block_test.rb
=====================================
--- a/plugins/profile_description_block/test/unit/profile_description_block_test.rb
+++ b/plugins/profile_description_block/test/unit/profile_description_block_test.rb
@@ -1,14 +1,14 @@
require File.expand_path(File.dirname(__FILE__) + "/../../../../test/test_helper")
class ProfileDescriptionBlockTest < ActiveSupport::TestCase
- def setup
- e = Environment.default
+ def setup
+ e = Environment.default
e.enabled_plugins = ['ProfileDescriptionPlugin']
@person = create_user('test_user').person
@profile = Profile.create!(:identifier => '1236',
:name => 'blabla',
:description => "")
- end
+ end
should 'describe itself' do
assert_not_equal Block.description, ProfileDescriptionBlock.description
@@ -17,7 +17,7 @@ class ProfileDescriptionBlockTest < ActiveSupport::TestCase
should "show profile description inside block" do
new_block = ProfileDescriptionBlock.create!
@profile.boxes.first.blocks << new_block
- block_menssage = "Description field are empty"
+ block_menssage = "Description field is empty"
assert (instance_eval(&Block.last.content).include?(block_menssage)),
"description block doesn't show not found description message"
description = "This is an test"
=====================================
plugins/require_auth_to_comment/features/require_auth_to_comment.feature
=====================================
--- a/plugins/require_auth_to_comment/features/require_auth_to_comment.feature
+++ b/plugins/require_auth_to_comment/features/require_auth_to_comment.feature
@@ -1,7 +1,7 @@
Feature: require authentication to comment
Background:
- Given plugin RequireAuthToCommentPlugin is enabled on environment
+ Given plugin RequireAuthToComment is enabled on environment
And the following users
| login |
| bozo |
=====================================
plugins/require_auth_to_comment/lib/ext/profile.rb
=====================================
--- a/plugins/require_auth_to_comment/lib/ext/profile.rb
+++ b/plugins/require_auth_to_comment/lib/ext/profile.rb
@@ -3,4 +3,8 @@ require_dependency 'profile'
class Profile
settings_items :allow_unauthenticated_comments, :type => :boolean
attr_accessible :allow_unauthenticated_comments
+
+ descendants.each do |descendant|
+ descendant.attr_accessible :allow_unauthenticated_comments
+ end
end
=====================================
plugins/send_email/controllers/send_email_plugin_base_controller.rb
=====================================
--- a/plugins/send_email/controllers/send_email_plugin_base_controller.rb
+++ b/plugins/send_email/controllers/send_email_plugin_base_controller.rb
@@ -11,7 +11,8 @@ module SendEmailPluginBaseController
)
@mail.subject = params[:subject] unless params[:subject].blank?
if @mail.valid?
- SendEmailPlugin::Sender.send_message(request.referer, @context_url, @mail).deliver
+ @referer = request.referer
+ SendEmailPlugin::Sender.send_message(@referer, @context_url, @mail).deliver
if request.xhr?
render :text => _('Message sent')
else
=====================================
plugins/send_email/lib/send_email_plugin.rb
=====================================
--- a/plugins/send_email/lib/send_email_plugin.rb
+++ b/plugins/send_email/lib/send_email_plugin.rb
@@ -16,9 +16,9 @@ class SendEmailPlugin < Noosfero::Plugin
def parse_content(html, source)
if context.profile
- html.gsub!(/\{sendemail\}/, "/profile/#{context.profile.identifier}/plugin/send_email/deliver")
+ html.gsub!(/({|%7[Bb])sendemail(}|%7[Dd])/, "/profile/#{context.profile.identifier}/plugin/send_email/deliver")
else
- html.gsub!(/\{sendemail\}/, '/plugin/send_email/deliver')
+ html.gsub!(/({|%7[Bb])sendemail(}|%7[Dd])/, '/plugin/send_email/deliver')
end
[html, source]
end
=====================================
plugins/send_email/lib/send_email_plugin/mail.rb
=====================================
--- a/plugins/send_email/lib/send_email_plugin/mail.rb
+++ b/plugins/send_email/lib/send_email_plugin/mail.rb
@@ -10,12 +10,11 @@ class SendEmailPlugin::Mail
validate :recipients_format
def initialize(attributes = {:subject => 'New mail'})
- @environment = attributes[:environment]
- @from = attributes[:from]
- @to = attributes[:to]
- @subject = attributes[:subject]
- @message = attributes[:message]
- @params = attributes[:params]
+ if attributes
+ attributes.each do |attr,value|
+ self.send("#{attr}=", value)
+ end
+ end
end
def recipients_format
@@ -36,7 +35,7 @@ class SendEmailPlugin::Mail
end
def params=(value = {})
- [:action, :controller, :to, :message, :subject, :from].each{|k| value.delete(k)}
+ [:profile, :action, :controller, :to, :message, :subject, :from, :commit].each{|k| value.delete(k)}
@params = value
end
=====================================
plugins/send_email/lib/send_email_plugin/sender.rb
=====================================
--- a/plugins/send_email/lib/send_email_plugin/sender.rb
+++ b/plugins/send_email/lib/send_email_plugin/sender.rb
@@ -7,9 +7,9 @@ class SendEmailPlugin::Sender < Noosfero::Plugin::MailerBase
@params = mail.params
mail(
+ content_type: 'text/plain',
to: mail.to,
from: mail.from,
- body: mail.params,
subject: "[#{mail.environment.name}] #{mail.subject}"
)
end
=====================================
plugins/send_email/test/functional/send_email_plugin_base_controller_test.rb
=====================================
--- a/plugins/send_email/test/functional/send_email_plugin_base_controller_test.rb
+++ b/plugins/send_email/test/functional/send_email_plugin_base_controller_test.rb
@@ -54,6 +54,13 @@ def run_common_tests
post :deliver, @extra_args.merge(:to => 'john at example.com', :message => 'Hi john', :subject => 'Hello john')
assert_equal '[Colivre.net] Hello john', ActionMailer::Base.deliveries.first.subject
end
+
+ should 'deliver mail with message from view' do
+ Environment.any_instance.stubs(:send_email_plugin_allow_to).returns('john at example.com')
+ post :deliver, @extra_args.merge(:to => 'john at example.com', :message => 'Hi john', :subject => 'Hello john')
+ assert_match /Contact from/, ActionMailer::Base.deliveries.first.body.to_s
+ end
+
end
class SendEmailPluginProfileControllerTest < ActionController::TestCase
=====================================
plugins/send_email/test/unit/send_email_plugin_sender_test.rb
=====================================
--- a/plugins/send_email/test/unit/send_email_plugin_sender_test.rb
+++ b/plugins/send_email/test/unit/send_email_plugin_sender_test.rb
@@ -15,12 +15,14 @@ class SendEmailPluginSenderTest < ActiveSupport::TestCase
end
should 'be able to deliver mail' do
+ @mail.expects(:params).returns({})
response = SendEmailPlugin::Sender.send_message("http://localhost/contact", 'http//profile', @mail)
assert_equal 'noreply at localhost', response.from.join
assert_equal "[Noosfero] #{@mail.subject}", response.subject
end
should 'deliver mail to john at example.com' do
+ @mail.expects(:params).returns({})
response = SendEmailPlugin::Sender.send_message("http://localhost/contact", 'http//profile', @mail)
assert_equal ['john at example.com'], response.to
end
=====================================
plugins/send_email/test/unit/send_email_plugin_test.rb
=====================================
--- a/plugins/send_email/test/unit/send_email_plugin_test.rb
+++ b/plugins/send_email/test/unit/send_email_plugin_test.rb
@@ -26,4 +26,12 @@ class SendEmailPluginTest < ActiveSupport::TestCase
assert_match /profile\/#{@plugin.context.profile.identifier}\/plugin\/send_email\/deliver/, @plugin.parse_content("expand this macro {sendemail}", nil).first
end
+ should 'expand macro used on form on profile context' do
+ profile = fast_create(Community)
+ @plugin.context.stubs(:profile).returns(profile)
+ article = RawHTMLArticle.create!(:name => 'Raw HTML', :body => "<form action='{sendemail}'></form>", :profile => profile)
+
+ assert_match /profile\/#{profile.identifier}\/plugin\/send_email\/deliver/, @plugin.parse_content(article.to_html, nil).first
+ end
+
end
=====================================
plugins/send_email/views/send_email_plugin/sender/message.html.erb → plugins/send_email/views/send_email_plugin/sender/send_message.html.erb
=====================================
--- a/plugins/send_email/views/send_email_plugin/sender/message.html.erb
+++ b/plugins/send_email/views/send_email_plugin/sender/send_message.html.erb
@@ -1,6 +1,7 @@
<%= _('Contact from %s') % @referer %>
<%= word_wrap(@message || @mail.message) %>
+
<% (@params || @mail.params).each_pair do |key, value| %>
<%= key %>: <%= word_wrap(value) %>
<% end %>
=====================================
plugins/send_email/views/send_email_plugin/success.html.erb
=====================================
--- a/plugins/send_email/views/send_email_plugin/success.html.erb
+++ b/plugins/send_email/views/send_email_plugin/success.html.erb
@@ -2,7 +2,7 @@
<table class='sendemail-plugin-message-sent'>
<tr><td class='label'><strong><%= c_('Subject') %>:</strong></td><td class='value'><em><%=h @mail.subject %></em></td></tr>
- <tr><td class='label'><strong><%= c_('Message') %>:</strong></td><td class='value'><pre><%=h render :file => 'send_email_plugin/sender/message' %></pre></td></tr>
+ <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>
</table>
<p><%= button :back, c_('Back'), :back %></p>
=====================================
plugins/stoa/lib/stoa_plugin.rb
=====================================
--- a/plugins/stoa/lib/stoa_plugin.rb
+++ b/plugins/stoa/lib/stoa_plugin.rb
@@ -60,13 +60,14 @@ class StoaPlugin < Noosfero::Plugin
end
def account_controller_filters
- block = lambda do |context|
+ block = proc do
params[:profile_data] ||= {}
params[:profile_data][:invitation_code] = params[:invitation_code]
invitation = Task.pending.find(:first, :conditions => {:code => params[:invitation_code]})
if request.post?
if !invitation && !StoaPlugin::UspUser.matches?(params[:profile_data][:usp_id], params[:confirmation_field], params[params[:confirmation_field]])
- @person = Person.new(:environment => context.environment)
+ # `self` below is evaluated in the context of account_controller
+ @person = Person.new(:environment => self.environment)
@person.errors.add(:usp_id, _(' validation failed'))
render :action => :signup
end
=====================================
plugins/stoa/lib/stoa_plugin/person_api.rb
=====================================
--- a/plugins/stoa/lib/stoa_plugin/person_api.rb
+++ b/plugins/stoa/lib/stoa_plugin/person_api.rb
@@ -16,7 +16,7 @@ class StoaPlugin::PersonApi < Noosfero::FieldsDecorator
end
def homepage
- context.url_for(url)
+ profile_homepage(context, object)
end
def birth_date
@@ -35,6 +35,16 @@ class StoaPlugin::PersonApi < Noosfero::FieldsDecorator
end
def communities
- object.communities.public.map {|community| {:url => context.url_for(community.url), :name => community.name}}
+ object.communities.public.map {|community| {:url => profile_homepage(context, community), :name => community.name}}
+ end
+
+ private
+
+ def profile_homepage(context, profile)
+ if context.respond_to?(:url_for)
+ context.url_for(profile.url)
+ else
+ profile.environment.top_url + '/' + profile.identifier
+ end
end
end
=====================================
plugins/stoa/test/functional/invite_controller_test.rb
=====================================
--- a/plugins/stoa/test/functional/invite_controller_test.rb
+++ b/plugins/stoa/test/functional/invite_controller_test.rb
@@ -57,7 +57,7 @@ class InviteControllerTest < ActionController::TestCase
organization.add_admin(admin)
login_as(admin.identifier)
- get :search_friend, :profile => organization.identifier, :q => '1234'
+ get :search, :profile => organization.identifier, :q => '1234'
assert_equal [{"id" => person.id, "name" => person.name}].to_json, @response.body
assert_response 200
=====================================
plugins/sub_organizations/features/sub_organizations_display.feature
=====================================
--- a/plugins/sub_organizations/features/sub_organizations_display.feature
+++ b/plugins/sub_organizations/features/sub_organizations_display.feature
@@ -29,6 +29,7 @@ Feature: sub_organizations_display
And I follow "Manage sub-groups"
And I follow "Register a new sub-enterprise"
And I fill in "Name" with "Bart"
+ And I fill in "Address" with "bart"
And I press "Next"
Then I should see "Enterprise registration completed"
And I am logged in as admin
=====================================
plugins/sub_organizations/lib/ext/create_enterprise.rb
=====================================
--- a/plugins/sub_organizations/lib/ext/create_enterprise.rb
+++ b/plugins/sub_organizations/lib/ext/create_enterprise.rb
@@ -2,4 +2,5 @@ require_dependency 'create_enterprise'
class CreateEnterprise
settings_items :sub_organizations_plugin_parent_to_be
+ DATA_FIELDS << 'sub_organizations_plugin_parent_to_be'
end
=====================================
po/fr/noosfero-doc.po
=====================================
--- a/po/fr/noosfero-doc.po
+++ b/po/fr/noosfero-doc.po
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2013-12-10 15:48-0300\n"
-"PO-Revision-Date: 2015-02-23 11:33+0200\n"
-"Last-Translator: Michal Čihař <michal at cihar.com>\n"
+"PO-Revision-Date: 2015-03-23 19:30+0200\n"
+"Last-Translator: Jérôme Jutteau <j.jutteau at gmail.com>\n"
"Language-Team: French "
"<https://hosted.weblate.org/projects/noosfero/documentation/fr/>\n"
"Language: fr\n"
@@ -36,7 +36,7 @@ msgstr ""
#: doc/noosfero/plugins/google_cse.en.xhtml:3
#: doc/noosfero/plugins/google_analytics.en.xhtml:3
msgid "Usage"
-msgstr ""
+msgstr "Utilisation"
# type: Content of: <ul><li>
#. type: Content of: <ul><li>
@@ -45,6 +45,8 @@ msgid ""
"Create a <span class=\"caps\">HTML</span> form using RawHTMLBlock or "
"RawHTMLArticle that invokes the {sendemail} action"
msgstr ""
+"Créer un formulaire <span class=\"caps\">HTML</span> utilisant RawHTMLBlock "
+"ou RawHTMLArticle qui appel l'action {sendemail}"
# type: Content of: <ul><li>
#. type: Content of: <ul><li>
=====================================
po/it/noosfero.po
=====================================
--- a/po/it/noosfero.po
+++ b/po/it/noosfero.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 1.0-690-gcb6e853\n"
"POT-Creation-Date: 2015-03-05 12:10-0300\n"
-"PO-Revision-Date: 2015-03-16 23:06+0200\n"
+"PO-Revision-Date: 2015-03-23 22:59+0200\n"
"Last-Translator: TWS <tablettws at gmail.com>\n"
"Language-Team: Italian "
"<https://hosted.weblate.org/projects/noosfero/noosfero/it/>\n"
@@ -6093,9 +6093,8 @@ msgid "Offline"
msgstr ""
#: app/views/shared/logged_in/xmpp_chat.html.erb:60
-#, fuzzy
msgid "Join room"
-msgstr "Accedere"
+msgstr "Accedere alla stanza"
#: app/views/shared/logged_in/xmpp_chat.html.erb:61
msgid "Leave room"
=====================================
po/pt/noosfero.po
=====================================
--- a/po/pt/noosfero.po
+++ b/po/pt/noosfero.po
@@ -13,8 +13,8 @@ msgid ""
msgstr ""
"Project-Id-Version: 1.0-690-gcb6e853\n"
"POT-Creation-Date: 2015-03-05 12:10-0300\n"
-"PO-Revision-Date: 2015-03-17 21:44+0200\n"
-"Last-Translator: Evandro Junior <evandrojr at gmail.com>\n"
+"PO-Revision-Date: 2015-03-29 01:47+0200\n"
+"Last-Translator: daniel <dtygel at eita.org.br>\n"
"Language-Team: Portuguese "
"<https://hosted.weblate.org/projects/noosfero/noosfero/pt/>\n"
"Language: pt\n"
@@ -7281,7 +7281,7 @@ msgstr "Seu nome"
#: app/views/cms/_upload_file_form.html.erb:4
#: app/views/cms/_text_editor_sidebar.html.erb:16
msgid "Choose folder to upload files:"
-msgstr "Escolha uma pasta para incluir arquivos:"
+msgstr "O arquivo ficará na seguinte pasta:"
#: app/views/cms/_upload_file_form.html.erb:16
msgid "More files"
@@ -7535,7 +7535,7 @@ msgstr "Houve problemas com os seguintes arquivos:"
#: app/views/cms/upload_files.html.erb:15
msgid "Publish media"
-msgstr "Publicar mídia"
+msgstr "Publicar imagem ou documento"
#: app/views/cms/upload_files.html.erb:17
msgid "Select the files you want to upload (max size %s):"
@@ -7551,7 +7551,7 @@ msgstr "Enviando arquivos para %s"
#: app/views/cms/_text_editor_sidebar.html.erb:8
msgid "Insert media"
-msgstr "Adicionar mídia"
+msgstr "Adicionar imagem ou documento"
#: app/views/cms/_text_editor_sidebar.html.erb:8
msgid "Show/Hide"
@@ -7559,7 +7559,7 @@ msgstr "Mostrar/Ocultar"
#: app/views/cms/_text_editor_sidebar.html.erb:21
msgid "New folder"
-msgstr "Nova pasta"
+msgstr "Criar pasta"
#: app/views/cms/_text_editor_sidebar.html.erb:26
msgid "Hide all uploads"
=====================================
public/javascripts/manage-fields.js
=====================================
--- a/public/javascripts/manage-fields.js
+++ b/public/javascripts/manage-fields.js
@@ -57,7 +57,7 @@ jQuery(document).ready(function(){
}
var checkbox = jQuery(checkboxes[i+3]).attr("id").split("_")
- jQuery("#" + checkbox.first() + "_" + checkbox.last()).attr("checked", allchecked)
+ jQuery("#" + checkbox[0] + "_" + checkbox[checkbox.length-1]).attr("checked", allchecked)
}
}
@@ -74,10 +74,10 @@ jQuery(document).ready(function(){
jQuery("input[type='checkbox']").click(function (){
var checkbox = jQuery(this).attr("id").split("_")
- verify_checked(checkbox.first())
+ verify_checked(checkbox[0])
if(this.checked == false) {
- jQuery("#" + checkbox.first() + "_" + checkbox.last()).attr("checked", false)
+ jQuery("#" + checkbox[0] + "_" + checkbox[checkbox.length-1]).attr("checked", false)
}
})
})
=====================================
script/production
=====================================
--- a/script/production
+++ b/script/production
@@ -85,7 +85,7 @@ environments_loop() {
}
do_running() {
- pids=$(cat tmp/pids/thin.*.pid 2>/dev/null || true)
+ pids=$(sed "s/.*/& /" tmp/pids/thin.*.pid | tr -d '\n' 2>/dev/null || true)
# passes if any of $pids exist, fails otherwise
kill -0 $pids > /dev/null 2>&1
}
=====================================
script/quick-start
=====================================
--- a/script/quick-start
+++ b/script/quick-start
@@ -114,7 +114,9 @@ else
rails runner 'Environment.default.enable("skip_new_user_email_confirmation")'
fi
-run quiet rake noosfero:translations:compile
+if [ ! -d locale ]; then
+ run quiet rake noosfero:translations:compile
+fi
# create needed directory
mkdir -p tmp/pids
=====================================
test/functional/cms_controller_test.rb
=====================================
--- a/test/functional/cms_controller_test.rb
+++ b/test/functional/cms_controller_test.rb
@@ -699,7 +699,7 @@ class CmsControllerTest < ActionController::TestCase
xhr :get, :update_categories, :profile => profile.identifier, :category_id => top.id
assert_template 'shared/update_categories'
assert_equal top, assigns(:current_category)
- assert_equal [c1, c2], assigns(:categories)
+ assert_equivalent [c1, c2], assigns(:categories)
end
should 'record when coming from public view on edit' do
=====================================
test/functional/contact_controller_test.rb
=====================================
--- a/test/functional/contact_controller_test.rb
+++ b/test/functional/contact_controller_test.rb
@@ -131,7 +131,7 @@ class ContactControllerTest < ActionController::TestCase
post :new, :profile => community.identifier
assert_response :forbidden
- assert_template :access_denied
+ assert_template :private_profile
end
should 'not show send e-mail page to non members of invisible community' do
=====================================
test/functional/events_controller_test.rb
=====================================
--- a/test/functional/events_controller_test.rb
+++ b/test/functional/events_controller_test.rb
@@ -60,7 +60,7 @@ class EventsControllerTest < ActionController::TestCase
post :events, :profile => community.identifier
assert_response :forbidden
- assert_template :access_denied
+ assert_template :private_profile
end
should 'not show events page to non members of invisible community' do
=====================================
test/functional/search_controller_test.rb
=====================================
--- a/test/functional/search_controller_test.rb
+++ b/test/functional/search_controller_test.rb
@@ -204,7 +204,7 @@ class SearchControllerTest < ActionController::TestCase
end
should 'paginate enterprise listing' do
- @controller.expects(:limit).returns(1)
+ @controller.expects(:limit).returns(1).at_least_once
ent1 = create_profile_with_optional_category(Enterprise, 'teste 1')
ent2 = create_profile_with_optional_category(Enterprise, 'teste 2')
=====================================
test/integration/categories_menu_test.rb deleted
=====================================
--- a/test/integration/categories_menu_test.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-require_relative "../test_helper"
-
-class CategoriesMenuTest < ActionController::IntegrationTest
-
- def setup
- HomeController.any_instance.stubs(:get_layout).returns('application')
- SearchController.any_instance.stubs(:get_layout).returns('application')
-
- Category.delete_all
- @cat1 = Category.create!(:display_in_menu => true, :name => 'Food', :environment => Environment.default, :display_color => '#888a85')
- @cat2 = Category.create!(:display_in_menu => true, :name => 'Vegetables', :environment => Environment.default, :parent => @cat1)
-
- # all categories must be shown for these tests
- Category.any_instance.stubs(:display_in_menu?).returns(true)
- end
-
- should 'display link to categories' do
- get '/'
- assert_tag :attributes => { :id => 'cat_menu' }, :descendant => { :tag => 'a', :attributes => { :href => '/cat/food/vegetables' } }
- end
-
- should 'display link to sub-categories' do
- get '/cat/food'
- # there must be a link to the subcategory
- assert_tag :attributes => { :id => 'cat_menu' }, :descendant => { :tag => 'a', :attributes => { :href => '/cat/food/vegetables' } }
- end
-
- should "always link to category's initial page in category menu" do
- get '/search/products/food/vegetables'
- assert_tag :attributes => { :id => 'cat_menu' }, :descendant => { :tag => 'a', :attributes => { :href => '/cat/food/vegetables' } }
- assert_no_tag :attributes => { :id => 'cat_menu' }, :descendant => { :tag => 'a', :attributes => { :href => '/searchh/products/food/vegetables' } }
- end
-
- should 'cache the categories menu' do
- ActionController::Base.perform_caching = true
- HomeController.any_instance.stubs(:fragment_cache_key).with(Environment.default.id.to_s + "_categories_menu").returns('dir')
- get '/'
- ActionController::Base.perform_caching = false
- end
-
-end
=====================================
test/unit/boxes_helper_test.rb
=====================================
--- a/test/unit/boxes_helper_test.rb
+++ b/test/unit/boxes_helper_test.rb
@@ -3,6 +3,7 @@ require 'boxes_helper'
class BoxesHelperTest < ActionView::TestCase
+ include ApplicationHelper
include BoxesHelper
include ActionView::Helpers::TagHelper
@@ -181,4 +182,20 @@ class BoxesHelperTest < ActionView::TestCase
display_box_content(box, '')
end
+ should 'display embed button when a block is embedable' do
+ box = create(Box, position: 1, owner: fast_create(Profile))
+ block = Block.create!(:box => box)
+ block.stubs(:embedable?).returns(true)
+ stubs(:url_for).returns('')
+ assert_tag_in_string block_edit_buttons(block), :tag => 'a', :attributes => {:class => 'button icon-button icon-embed '}
+ end
+
+ should 'not display embed button when a block is not embedable' do
+ box = create(Box, position: 1, owner: fast_create(Profile))
+ block = Block.create!(:box => box)
+ block.stubs(:embedable?).returns(false)
+ stubs(:url_for).returns('')
+ assert_no_tag_in_string block_edit_buttons(block), :tag => 'a', :attributes => {:class => 'button icon-button icon-embed '}
+ end
+
end
=====================================
test/unit/profile_test.rb
=====================================
--- a/test/unit/profile_test.rb
+++ b/test/unit/profile_test.rb
@@ -110,6 +110,16 @@ class ProfileTest < ActiveSupport::TestCase
assert_equal total - mine, Article.count
end
+ should 'remove images when removing profile' do
+ profile = build(Profile, :image_builder => {:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')})
+ image = profile.image
+ image.save!
+ profile.destroy
+ assert_raise ActiveRecord::RecordNotFound do
+ image.reload
+ end
+ end
+
def test_should_avoid_reserved_identifiers
Profile::RESERVED_IDENTIFIERS.each do |identifier|
assert_invalid_identifier identifier
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/5225e5d44e9b6d7866ddd47845d81236b301e696...42e1b8afae156864f9634468b64d7af41b42b5b6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150416/3fc633dc/attachment-0001.html>
More information about the Noosfero-dev
mailing list