Commit c806d8212b69665e8a5f65348c5fd87e7355704b
1 parent
ced9acfd
Exists in
master
and in
28 other branches
Adding "My Communities" to the user menu
ActionItem1030
Showing
5 changed files
with
52 additions
and
6 deletions
Show diff stats
app/helpers/application_helper.rb
| @@ -1140,6 +1140,17 @@ module ApplicationHelper | @@ -1140,6 +1140,17 @@ module ApplicationHelper | ||
| 1140 | end | 1140 | end |
| 1141 | end | 1141 | end |
| 1142 | 1142 | ||
| 1143 | + def manage_communities | ||
| 1144 | + return if not user | ||
| 1145 | + administered_communities = user.communities.select {|c| c.admins.include? user} | ||
| 1146 | + if !administered_communities.empty? | ||
| 1147 | + communities_link = administered_communities.map do |community| | ||
| 1148 | + link_to(content_tag('strong', [_('<span>Manage</span> %s') % community.short_name(25)]), @environment.top_url + "/myprofile/#{community.identifier}", :class => "icon-menu-"+community.class.identification.underscore, :title => [_('Manage %s') % community.short_name]) | ||
| 1149 | + end | ||
| 1150 | + render :partial => 'shared/manage_communities', :locals => {:communities_link => communities_link} | ||
| 1151 | + end | ||
| 1152 | + end | ||
| 1153 | + | ||
| 1143 | def usermenu_logged_in | 1154 | def usermenu_logged_in |
| 1144 | pending_tasks_count = '' | 1155 | pending_tasks_count = '' |
| 1145 | count = user ? Task.to(user).pending.count : -1 | 1156 | count = user ? Task.to(user).pending.count : -1 |
| @@ -1151,6 +1162,7 @@ module ApplicationHelper | @@ -1151,6 +1162,7 @@ module ApplicationHelper | ||
| 1151 | render_environment_features(:usermenu) + | 1162 | render_environment_features(:usermenu) + |
| 1152 | link_to('<i class="icon-menu-admin"></i><strong>' + _('Administration') + '</strong>', @environment.top_url + '/admin', :id => "controlpanel", :title => _("Configure the environment"), :class => 'admin-link', :style => 'display: none') + | 1163 | link_to('<i class="icon-menu-admin"></i><strong>' + _('Administration') + '</strong>', @environment.top_url + '/admin', :id => "controlpanel", :title => _("Configure the environment"), :class => 'admin-link', :style => 'display: none') + |
| 1153 | manage_enterprises.to_s + | 1164 | manage_enterprises.to_s + |
| 1165 | + manage_communities.to_s + | ||
| 1154 | link_to('<i class="icon-menu-ctrl-panel"></i><strong>' + _('Control panel') + '</strong>', @environment.top_url + '/myprofile/{login}', :id => "controlpanel", :title => _("Configure your personal account and content")) + | 1166 | link_to('<i class="icon-menu-ctrl-panel"></i><strong>' + _('Control panel') + '</strong>', @environment.top_url + '/myprofile/{login}', :id => "controlpanel", :title => _("Configure your personal account and content")) + |
| 1155 | pending_tasks_count + | 1167 | pending_tasks_count + |
| 1156 | link_to('<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) | 1168 | link_to('<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) |
app/views/shared/_manage_enterprises.rhtml
| 1 | -<div id='manage-enterprises'> | ||
| 2 | - <a href="#" id='manage-enterprises-link' class='simplemenu-trigger' title='<%= _('Manage enterprises') %>'><i class="icon-menu-enterprise"></i><strong><%= ui_icon('ui-icon-triangle-1-s') + _('My enterprises') %></strong></a> | ||
| 3 | - <ul class='simplemenu-submenu'> | 1 | +<div id="manage-enterprises" class="manage-groups"> |
| 2 | + <a href="#" id="manage-enterprises-link" class="simplemenu-trigger" title="<%= _('Manage enterprises') %>"><i class="icon-menu-enterprise"></i><strong><%= ui_icon('ui-icon-triangle-1-s') + _('My enterprises') %></strong></a> | ||
| 3 | + <ul class="simplemenu-submenu"> | ||
| 4 | <% enterprises_link.each do |link| %> | 4 | <% enterprises_link.each do |link| %> |
| 5 | - <li class='simplemenu-item'><%= link %></li> | 5 | + <li class="simplemenu-item"><%= link %></li> |
| 6 | <% end %> | 6 | <% end %> |
| 7 | </ul> | 7 | </ul> |
| 8 | </div> | 8 | </div> |
public/designs/themes/base/style.css
| @@ -89,7 +89,7 @@ body, th, td, input { | @@ -89,7 +89,7 @@ body, th, td, input { | ||
| 89 | color: #555753; | 89 | color: #555753; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | -#controlpanel, #logout, #openchat, #manage-enterprises { | 92 | +#controlpanel, #logout, #openchat, .manage-groups { |
| 93 | margin-left: 25px; | 93 | margin-left: 25px; |
| 94 | } | 94 | } |
| 95 | 95 |
public/javascripts/application.js
| @@ -679,7 +679,7 @@ jQuery(function($) { | @@ -679,7 +679,7 @@ jQuery(function($) { | ||
| 679 | document.location.href = this.href; | 679 | document.location.href = this.href; |
| 680 | }) | 680 | }) |
| 681 | } | 681 | } |
| 682 | - $('#manage-enterprises-link').live('click', function() { | 682 | + $('.manage-groups > a').live('click', function() { |
| 683 | toggleMenu(this); | 683 | toggleMenu(this); |
| 684 | return false; | 684 | return false; |
| 685 | }); | 685 | }); |
public/stylesheets/application.css
| @@ -878,6 +878,40 @@ code input { | @@ -878,6 +878,40 @@ code input { | ||
| 878 | .webkit #manage-enterprises .simplemenu-submenu { | 878 | .webkit #manage-enterprises .simplemenu-submenu { |
| 879 | top: 20px; | 879 | top: 20px; |
| 880 | } | 880 | } |
| 881 | +#manage-communities { | ||
| 882 | + display: inline-block; | ||
| 883 | + margin-right: 5px; | ||
| 884 | + position: relative; | ||
| 885 | +} | ||
| 886 | +#manage-communities .ui-icon { | ||
| 887 | + position: absolute; | ||
| 888 | + top: 0; | ||
| 889 | + right: -20px; | ||
| 890 | +} | ||
| 891 | +#manage-communities .simplemenu-submenu { | ||
| 892 | + text-align: left; | ||
| 893 | + left: -20px; | ||
| 894 | + width: 200px; | ||
| 895 | +} | ||
| 896 | +#manage-communities .simplemenu-item { | ||
| 897 | + padding: 5px 0; | ||
| 898 | +} | ||
| 899 | +#manage-communities .simplemenu-item a { | ||
| 900 | + background-repeat: no-repeat; | ||
| 901 | + padding-left: 20px; | ||
| 902 | +} | ||
| 903 | +#manage-communities .simplemenu-item a span { | ||
| 904 | + display: none; | ||
| 905 | +} | ||
| 906 | +.msie8 #manage-communities-link { /* IE8 hack */ | ||
| 907 | + border: 0px solid; | ||
| 908 | +} | ||
| 909 | +.msie8 #manage-communities .simplemenu-submenu { | ||
| 910 | + top: 16px; | ||
| 911 | +} | ||
| 912 | +.webkit #manage-communities .simplemenu-submenu { | ||
| 913 | + top: 20px; | ||
| 914 | +} | ||
| 881 | #article { | 915 | #article { |
| 882 | position: relative; | 916 | position: relative; |
| 883 | text-align: justify; | 917 | text-align: justify; |