Commit 50e9fe927b1317a2c531fb8a803366c5d9e3f783

Authored by Rodrigo Souto
1 parent 1389ea0d

social-share-privacy-plugin: use article extra content hotspot

Instead of create another hotspot that does the same thing, use the
existing one. If the demand for separation appears in the future than we
may do it.
app/views/content_viewer/view_page.html.erb
@@ -68,8 +68,6 @@ @@ -68,8 +68,6 @@
68 68
69 <%= display_source_info(@page) %> 69 <%= display_source_info(@page) %>
70 70
71 -<%= @plugins.dispatch(:social_buttons_contents).collect { |content| instance_exec(&content) }.join("") %>  
72 -  
73 <%= @plugins.dispatch(:article_extra_contents, @page).collect { |content| instance_exec(&content) }.join("") %> 71 <%= @plugins.dispatch(:article_extra_contents, @page).collect { |content| instance_exec(&content) }.join("") %>
74 72
75 <div class="comments" id="comments_list"> 73 <div class="comments" id="comments_list">
lib/noosfero/plugin.rb
@@ -398,12 +398,6 @@ class Noosfero::Plugin @@ -398,12 +398,6 @@ class Noosfero::Plugin
398 nil 398 nil
399 end 399 end
400 400
401 - # -> Adds social networks share buttons to content  
402 - # returns = proc that creates html code  
403 - def social_buttons_contents  
404 - nil  
405 - end  
406 -  
407 # -> Adds fields to the signup form 401 # -> Adds fields to the signup form
408 # returns = proc that creates html code 402 # returns = proc that creates html code
409 def signup_extra_contents 403 def signup_extra_contents
plugins/social_share_privacy/lib/social_share_privacy_plugin.rb
@@ -16,7 +16,7 @@ class SocialSharePrivacyPlugin &lt; Noosfero::Plugin @@ -16,7 +16,7 @@ class SocialSharePrivacyPlugin &lt; Noosfero::Plugin
16 true 16 true
17 end 17 end
18 18
19 - def social_buttons_contents 19 + def article_extra_contents(article)
20 proc do 20 proc do
21 settings = Noosfero::Plugin::Settings.new(environment, SocialSharePrivacyPlugin) 21 settings = Noosfero::Plugin::Settings.new(environment, SocialSharePrivacyPlugin)
22 locale = FastGettext.locale 22 locale = FastGettext.locale
plugins/social_share_privacy/test/unit/social_share_privacy_test.rb
@@ -27,7 +27,7 @@ class SocialSharePrivacyPluginTest &lt; ActiveSupport::TestCase @@ -27,7 +27,7 @@ class SocialSharePrivacyPluginTest &lt; ActiveSupport::TestCase
27 27
28 should 'return html code for social share privacy buttons' do 28 should 'return html code for social share privacy buttons' do
29 self.stubs(:environment).returns(Environment.default) 29 self.stubs(:environment).returns(Environment.default)
30 - content = @plugin.social_buttons_contents 30 + content = @plugin.article_extra_contents(mock())
31 assert self.instance_eval(&content) 31 assert self.instance_eval(&content)
32 end 32 end
33 33
test/functional/content_viewer_controller_test.rb
@@ -1447,29 +1447,4 @@ class ContentViewerControllerTest &lt; ActionController::TestCase @@ -1447,29 +1447,4 @@ class ContentViewerControllerTest &lt; ActionController::TestCase
1447 assert_tag :tag => 'meta', :attributes => { :property => 'og:image', :content => /\/images\/x.png/ } 1447 assert_tag :tag => 'meta', :attributes => { :property => 'og:image', :content => /\/images\/x.png/ }
1448 end 1448 end
1449 1449
1450 - should 'add social content on content view page from plugins' do  
1451 - class Plugin1 < Noosfero::Plugin  
1452 - def social_buttons_contents  
1453 - proc {"<strong>Plugin1 text</strong>"}  
1454 - end  
1455 - end  
1456 - class Plugin2 < Noosfero::Plugin  
1457 - def social_buttons_contents  
1458 - proc {"<div class='social-buttons'></div>"}  
1459 - end  
1460 - end  
1461 - Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name])  
1462 -  
1463 - Environment.default.enable_plugin(Plugin1.name)  
1464 - Environment.default.enable_plugin(Plugin2.name)  
1465 -  
1466 - page = profile.articles.build(:name => 'test')  
1467 - page.save!  
1468 -  
1469 - get :view_page, :profile => profile.identifier, :page => ['test']  
1470 -  
1471 - assert_tag :tag => 'strong', :content => 'Plugin1 text'  
1472 - assert_tag :tag => 'div', :attributes => {:class => 'social-buttons'}  
1473 - end  
1474 -  
1475 end 1450 end