From 50e9fe927b1317a2c531fb8a803366c5d9e3f783 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Thu, 11 Sep 2014 11:44:47 -0300 Subject: [PATCH] social-share-privacy-plugin: use article extra content hotspot --- app/views/content_viewer/view_page.html.erb | 2 -- lib/noosfero/plugin.rb | 6 ------ plugins/social_share_privacy/lib/social_share_privacy_plugin.rb | 2 +- plugins/social_share_privacy/test/unit/social_share_privacy_test.rb | 2 +- test/functional/content_viewer_controller_test.rb | 25 ------------------------- 5 files changed, 2 insertions(+), 35 deletions(-) diff --git a/app/views/content_viewer/view_page.html.erb b/app/views/content_viewer/view_page.html.erb index 48fbffb..a41f631 100644 --- a/app/views/content_viewer/view_page.html.erb +++ b/app/views/content_viewer/view_page.html.erb @@ -68,8 +68,6 @@ <%= display_source_info(@page) %> -<%= @plugins.dispatch(:social_buttons_contents).collect { |content| instance_exec(&content) }.join("") %> - <%= @plugins.dispatch(:article_extra_contents, @page).collect { |content| instance_exec(&content) }.join("") %>
diff --git a/lib/noosfero/plugin.rb b/lib/noosfero/plugin.rb index a240c34..b29175e 100644 --- a/lib/noosfero/plugin.rb +++ b/lib/noosfero/plugin.rb @@ -398,12 +398,6 @@ class Noosfero::Plugin nil end - # -> Adds social networks share buttons to content - # returns = proc that creates html code - def social_buttons_contents - nil - end - # -> Adds fields to the signup form # returns = proc that creates html code def signup_extra_contents diff --git a/plugins/social_share_privacy/lib/social_share_privacy_plugin.rb b/plugins/social_share_privacy/lib/social_share_privacy_plugin.rb index a04b575..5687149 100644 --- a/plugins/social_share_privacy/lib/social_share_privacy_plugin.rb +++ b/plugins/social_share_privacy/lib/social_share_privacy_plugin.rb @@ -16,7 +16,7 @@ class SocialSharePrivacyPlugin < Noosfero::Plugin true end - def social_buttons_contents + def article_extra_contents(article) proc do settings = Noosfero::Plugin::Settings.new(environment, SocialSharePrivacyPlugin) locale = FastGettext.locale diff --git a/plugins/social_share_privacy/test/unit/social_share_privacy_test.rb b/plugins/social_share_privacy/test/unit/social_share_privacy_test.rb index 3637658..56817bc 100644 --- a/plugins/social_share_privacy/test/unit/social_share_privacy_test.rb +++ b/plugins/social_share_privacy/test/unit/social_share_privacy_test.rb @@ -27,7 +27,7 @@ class SocialSharePrivacyPluginTest < ActiveSupport::TestCase should 'return html code for social share privacy buttons' do self.stubs(:environment).returns(Environment.default) - content = @plugin.social_buttons_contents + content = @plugin.article_extra_contents(mock()) assert self.instance_eval(&content) end diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb index a705f27..03ef14c 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -1447,29 +1447,4 @@ class ContentViewerControllerTest < ActionController::TestCase assert_tag :tag => 'meta', :attributes => { :property => 'og:image', :content => /\/images\/x.png/ } end - should 'add social content on content view page from plugins' do - class Plugin1 < Noosfero::Plugin - def social_buttons_contents - proc {"Plugin1 text"} - end - end - class Plugin2 < Noosfero::Plugin - def social_buttons_contents - proc {""} - end - end - Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) - - Environment.default.enable_plugin(Plugin1.name) - Environment.default.enable_plugin(Plugin2.name) - - page = profile.articles.build(:name => 'test') - page.save! - - get :view_page, :profile => profile.identifier, :page => ['test'] - - assert_tag :tag => 'strong', :content => 'Plugin1 text' - assert_tag :tag => 'div', :attributes => {:class => 'social-buttons'} - end - end -- libgit2 0.21.2