[Git][noosfero/noosfero][master] 2 commits: Change method name

Rodrigo Souto gitlab at mg.gitlab.com
Thu Jul 6 18:07:31 BRT 2017


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
87d00926 by antoniocoj at 2017-07-06T17:42:24-03:00
Change method name

Signed-off-by: antoniocoj <_antonio_ at hotmail.com>

- - - - -
f5afa5da by Rodrigo Souto at 2017-07-06T21:06:57+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/compare/ede5e861d7e343cb374ab03d0c8d0449b9fce168...f5afa5da83557767b1a29771f3c0337a3c68fac0

---
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/ede5e861d7e343cb374ab03d0c8d0449b9fce168...f5afa5da83557767b1a29771f3c0337a3c68fac0
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/317ef4bc/attachment-0001.html>


More information about the Noosfero-dev mailing list