[Git][noosfero/noosfero][stable-1.8] Merge branch 'refactor_usermenu_logged_in' into 'master'
Rodrigo Souto
gitlab at mg.gitlab.com
Thu Jul 6 18:33:12 BRT 2017
Rodrigo Souto pushed to branch stable-1.8 at Noosfero / noosfero
Commits:
da8732ca by Rodrigo Souto at 2017-07-06T21:32:59+00:00
Merge branch 'refactor_usermenu_logged_in' into 'master'
Refactor usermenu logged in
See merge request !1269
- - - - -
1 changed file:
- app/helpers/application_helper.rb
Changes:
=====================================
app/helpers/application_helper.rb
=====================================
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -893,24 +893,19 @@ module ApplicationHelper
def usermenu_logged_in
pending_tasks_count = ''
count = user ? Task.to(user).pending.count : -1
+
if count > 0
- pending_tasks_count = link_to(count.to_s, user.tasks_url, :id => 'pending-tasks-count', :title => _("Manage your pending tasks"))
+ pending_tasks_count = link_to(count.to_s,
+ user.tasks_url,
+ :id => 'pending-tasks-count',
+ :title => _("Manage your pending tasks"))
end
- user_identifier = "<i style='background-image:url(#{user.profile_custom_icon(gravatar_default)})'></i><strong>#{user.identifier}</strong>"
-
- welcome_link = link_to(user_identifier.html_safe, user.public_profile_url, :id => "homepage-link", :title => _('Go to your homepage'))
- welcome_span = _("<span class='welcome'>Welcome,</span> %s") % welcome_link.html_safe
-
- ctrl_panel_icon = '<i class="icon-menu-ctrl-panel"></i>'
- ctrl_panel_section = '<strong>' + ctrl_panel_icon + _('Control panel') + '</strong>'
- ctrl_panel_link = link_to(ctrl_panel_section.html_safe, user.admin_url, :class => 'ctrl-panel', :title => _("Configure your personal account and content"))
-
- logout_icon = '<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>'
- logout_link = link_to(logout_icon.html_safe, { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system"))
-
- plugins_items = @plugins.dispatch(:user_menu_items, user).collect { |content| instance_eval(&content) }
+ join_result = safe_join(user_menu_items(pending_tasks_count), "")
+ join_result
+ end
+ def user_menu_items (pending_tasks_count)
items = [
welcome_span.html_safe,
*plugins_items,
@@ -922,9 +917,39 @@ module ApplicationHelper
pending_tasks_count.html_safe,
logout_link.html_safe
]
- join_result = safe_join(
- items, "")
- join_result
+ items
+ end
+
+ def logout_link
+ logout_icon = '<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>'
+ logout_link = link_to(logout_icon.html_safe,
+ {:controller => 'account',:action => 'logout'},
+ :id => "logout", :title => _("Leave the system"))
+ logout_link
+ end
+
+ def plugins_items
+ plugins_items = @plugins.dispatch(:user_menu_items, user).collect { |content| instance_eval(&content) }
+ plugins_items
+ end
+
+ def welcome_span
+ user_identifier = "<i style='background-image:url(#{user.profile_custom_icon(gravatar_default)})'></i><strong>#{user.identifier}</strong>"
+ welcome_link = link_to(user_identifier.html_safe,
+ user.public_profile_url,
+ :id => "homepage-link",
+ :title => _('Go to your homepage'))
+ welcome_span = _("<span class='welcome'>Welcome,</span> %s") % welcome_link.html_safe
+ welcome_span
+ end
+
+ def ctrl_panel_link
+ ctrl_panel_icon = '<i class="icon-menu-ctrl-panel"></i>'
+ ctrl_panel_section = '<strong>' + ctrl_panel_icon + _('Control panel') + '</strong>'
+ ctrl_panel_link = link_to(ctrl_panel_section.html_safe, user.admin_url,
+ :class => 'ctrl-panel',
+ :title => _("Configure your personal account and content"))
+ ctrl_panel_link
end
def usermenu_notlogged_in
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/da8732ca030cafe41d997d23c2c16da9b8389d74
---
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/da8732ca030cafe41d997d23c2c16da9b8389d74
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170706/30662e13/attachment-0001.html>
More information about the Noosfero-dev
mailing list