Commit 720fc0fc0be4af4784516386c24029db32ca4bfa
Exists in
master
and in
29 other branches
Merge branch 'networks-interaction' into feedback
[social-share] fixes previous update, that failed to change some files. now i really did the merge with the "organized" branch, so everything should be working the same. Conflicts: app/views/content_viewer/view_page.html.erb lib/noosfero/plugin.rb
Showing
3 changed files
with
28 additions
and
3 deletions
Show diff stats
app/views/content_viewer/view_page.html.erb
@@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
42 | 42 | ||
43 | <%= render :partial => 'shared/disabled_enterprise' %> | 43 | <%= render :partial => 'shared/disabled_enterprise' %> |
44 | 44 | ||
45 | -<%= @plugins.dispatch(:social_buttons_javascript, @page).collect { |content| instance_exec(&content) }.join("") %> | 45 | +<%= @plugins.dispatch(:social_buttons_contents).collect { |content| instance_exec(&content) }.join("") %> |
46 | <% if NOOSFERO_CONF['addthis_enabled'] %> | 46 | <% if NOOSFERO_CONF['addthis_enabled'] %> |
47 | <%= render :partial => 'addthis' %> | 47 | <%= render :partial => 'addthis' %> |
48 | <% end %> | 48 | <% end %> |
lib/noosfero/plugin.rb
@@ -395,8 +395,8 @@ class Noosfero::Plugin | @@ -395,8 +395,8 @@ class Noosfero::Plugin | ||
395 | end | 395 | end |
396 | 396 | ||
397 | # -> Adds social networks share buttons to content | 397 | # -> Adds social networks share buttons to content |
398 | - # returns = lambda block that creates html code | ||
399 | - def social_buttons_javascript(environment) | 398 | + # returns = proc that creates html code |
399 | + def social_buttons_contents | ||
400 | nil | 400 | nil |
401 | end | 401 | end |
402 | 402 |
test/functional/content_viewer_controller_test.rb
@@ -1391,4 +1391,29 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -1391,4 +1391,29 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
1391 | assert_tag :tag => 'meta', :attributes => { :property => 'og:image', :content => /\/images\/x.png/ } | 1391 | assert_tag :tag => 'meta', :attributes => { :property => 'og:image', :content => /\/images\/x.png/ } |
1392 | end | 1392 | end |
1393 | 1393 | ||
1394 | + should 'add social content on content view page from plugins' do | ||
1395 | + class Plugin1 < Noosfero::Plugin | ||
1396 | + def social_buttons_contents | ||
1397 | + proc {"<strong>Plugin1 text</strong>"} | ||
1398 | + end | ||
1399 | + end | ||
1400 | + class Plugin2 < Noosfero::Plugin | ||
1401 | + def social_buttons_contents | ||
1402 | + proc {"<div class='social-buttons'></div>"} | ||
1403 | + end | ||
1404 | + end | ||
1405 | + Noosfero::Plugin.stubs(:all).returns([Plugin1.name, Plugin2.name]) | ||
1406 | + | ||
1407 | + Environment.default.enable_plugin(Plugin1.name) | ||
1408 | + Environment.default.enable_plugin(Plugin2.name) | ||
1409 | + | ||
1410 | + page = profile.articles.build(:name => 'test') | ||
1411 | + page.save! | ||
1412 | + | ||
1413 | + get :view_page, :profile => profile.identifier, :page => ['test'] | ||
1414 | + | ||
1415 | + assert_tag :tag => 'strong', :content => 'Plugin1 text' | ||
1416 | + assert_tag :tag => 'div', :attributes => {:class => 'social-buttons'} | ||
1417 | + end | ||
1418 | + | ||
1394 | end | 1419 | end |