diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 9fbfa95..5a50b34 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -553,6 +553,9 @@ module ApplicationHelper
# displays a link to the profile homepage with its image (as generated by
# #profile_image) and its name below it.
def profile_image_link( profile, size=:portrait, tag='li', extra_info = nil )
+ if content = @plugins.first_impl(:profile_image_link, profile)
+ return instance_eval(&content)
+ end
name = profile.short_name
if profile.person?
url = url_for(profile.check_friendship_url)
@@ -569,16 +572,16 @@ module ApplicationHelper
extra_info = extra_info.nil? ? '' : content_tag( 'span', extra_info, :class => 'extra_info' )
links = links_for_balloon(profile)
content_tag('div', content_tag(tag,
- (environment.enabled?(:show_balloon_with_profile_links_when_clicked) ? link_to( content_tag( 'span', _('Profile links')), '#', :onclick => "toggleSubmenu(this, '#{profile.short_name}', #{links.to_json}); return false", :class => "menu-submenu-trigger #{trigger_class}", :url => url) : "") +
- link_to(
- content_tag( 'span', profile_image( profile, size ), :class => 'profile-image' ) +
- content_tag( 'span', h(name), :class => ( profile.class == Person ? 'fn' : 'org' ) ) +
- extra_info + profile_sex_icon( profile ) + profile_cat_icons( profile ),
- profile.url,
- :class => 'profile_link url',
- :help => _('Click on this icon to go to the %s\'s home page') % profile.name,
- :title => profile.name ),
- :class => 'vcard'), :class => 'common-profile-list-block')
+ (environment.enabled?(:show_balloon_with_profile_links_when_clicked) ? link_to( content_tag( 'span', _('Profile links')), '#', :onclick => "toggleSubmenu(this, '#{profile.short_name}', #{links.to_json}); return false", :class => "menu-submenu-trigger #{trigger_class}", :url => url) : "") +
+ link_to(
+ content_tag( 'span', profile_image( profile, size ), :class => 'profile-image' ) +
+ content_tag( 'span', h(name), :class => ( profile.class == Person ? 'fn' : 'org' ) ) +
+ extra_info + profile_sex_icon( profile ) + profile_cat_icons( profile ),
+ profile.url,
+ :class => 'profile_link url',
+ :help => _('Click on this icon to go to the %s\'s home page') % profile.name,
+ :title => profile.name ),
+ :class => 'vcard'), :class => 'common-profile-list-block')
end
def gravatar_url_for(email, options = {})
diff --git a/lib/noosfero/plugin.rb b/lib/noosfero/plugin.rb
index 8d1d371..d1ff723 100644
--- a/lib/noosfero/plugin.rb
+++ b/lib/noosfero/plugin.rb
@@ -128,6 +128,7 @@ class Noosfero::Plugin
# Here the developer may specify the events to which the plugins can
# register and must return true or false. The default value must be false.
+ # Must also explicitly defined its returning variables.
# -> If true, noosfero will include plugin_dir/public/style.css into
# application
@@ -135,10 +136,6 @@ class Noosfero::Plugin
false
end
- # Here the developer should specify the events to which the plugins can
- # register to. Must be explicitly defined its returning
- # variables.
-
# -> Adds buttons to the control panel
# returns = { :title => title, :icon => icon, :url => url }
# title = name that will be displayed.
@@ -148,6 +145,13 @@ class Noosfero::Plugin
nil
end
+ # -> Customize profile block design and behavior
+ # (overwrites profile_image_link function)
+ # returns = lambda block that creates html code.
+ def profile_image_link profile
+ nil
+ end
+
# -> Adds tabs to the profile
# returns = { :title => title, :id => id, :content => content, :start => start }
# title = name that will be displayed.
diff --git a/lib/noosfero/plugin/manager.rb b/lib/noosfero/plugin/manager.rb
index 8d9f41e..3616cf7 100644
--- a/lib/noosfero/plugin/manager.rb
+++ b/lib/noosfero/plugin/manager.rb
@@ -27,6 +27,17 @@ class Noosfero::Plugin::Manager
map { |plugin| plugin.send(event, *args) }.compact
end
+ # return first implementation of a specific hotspot
+ def first_impl(event, *args)
+ default = Noosfero::Plugin.new.send(event, *args)
+ impl = default
+ each do |plugin|
+ impl = plugin.send(event, *args)
+ break if impl != default
+ end
+ impl
+ end
+
alias :dispatch_scopes :dispatch_without_flatten
def enabled_plugins
--
libgit2 0.21.2