Commit f2a648b71519d56afe5aa1d08455abbf2d0f3778
Committed by
Daniela Feitosa
1 parent
405f5528
Exists in
master
and in
29 other branches
Adding links on usermenu to manage enterprises
(ActionItem1925)
Showing
6 changed files
with
84 additions
and
2 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -1104,6 +1104,15 @@ module ApplicationHelper | @@ -1104,6 +1104,15 @@ module ApplicationHelper | ||
1104 | result | 1104 | result |
1105 | end | 1105 | end |
1106 | 1106 | ||
1107 | + def manage_enterprises | ||
1108 | + if user && !user.enterprises.empty? | ||
1109 | + enterprises_link = user.enterprises.map do |enterprise| | ||
1110 | + link_to(content_tag('strong', [_('<span>Manage</span> %s') % enterprise.short_name(25)]), "/myprofile/#{enterprise.identifier}", :class => "icon-menu-enterprise", :title => [_('Manage %s') % enterprise.short_name]) | ||
1111 | + end | ||
1112 | + render :partial => 'shared/manage_enterprises', :locals => {:enterprises_link => enterprises_link} | ||
1113 | + end | ||
1114 | + end | ||
1115 | + | ||
1107 | def usermenu_logged_in | 1116 | def usermenu_logged_in |
1108 | pending_tasks_count = '' | 1117 | pending_tasks_count = '' |
1109 | if user && user.all_pending_tasks.count > 0 | 1118 | if user && user.all_pending_tasks.count > 0 |
@@ -1113,6 +1122,7 @@ module ApplicationHelper | @@ -1113,6 +1122,7 @@ module ApplicationHelper | ||
1113 | (_('Welcome, %s') % link_to('<i></i><strong>{login}</strong>', '/{login}', :id => "homepage-link", :title => _('Go to your homepage'))) + | 1122 | (_('Welcome, %s') % link_to('<i></i><strong>{login}</strong>', '/{login}', :id => "homepage-link", :title => _('Go to your homepage'))) + |
1114 | render_environment_features(:usermenu) + | 1123 | render_environment_features(:usermenu) + |
1115 | link_to('<i class="icon-menu-admin"></i><strong>' + _('Administration') + '</strong>', { :controller => 'admin_panel', :action => 'index' }, :id => "controlpanel", :title => _("Configure the environment"), :class => 'admin-link', :style => 'display: none') + | 1124 | link_to('<i class="icon-menu-admin"></i><strong>' + _('Administration') + '</strong>', { :controller => 'admin_panel', :action => 'index' }, :id => "controlpanel", :title => _("Configure the environment"), :class => 'admin-link', :style => 'display: none') + |
1125 | + manage_enterprises.to_s + | ||
1116 | link_to('<i class="icon-menu-ctrl-panel"></i><strong>' + _('Control panel') + '</strong>', '/myprofile/{login}', :id => "controlpanel", :title => _("Configure your personal account and content")) + | 1126 | link_to('<i class="icon-menu-ctrl-panel"></i><strong>' + _('Control panel') + '</strong>', '/myprofile/{login}', :id => "controlpanel", :title => _("Configure your personal account and content")) + |
1117 | pending_tasks_count + | 1127 | pending_tasks_count + |
1118 | link_to('<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) | 1128 | link_to('<i class="icon-menu-logout"></i><strong>' + _('Logout') + '</strong>', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) |
@@ -0,0 +1,8 @@ | @@ -0,0 +1,8 @@ | ||
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'> | ||
4 | + <% enterprises_link.each do |link| %> | ||
5 | + <li class='simplemenu-item'><%= link %></li> | ||
6 | + <% end %> | ||
7 | + </ul> | ||
8 | +</div> |
@@ -0,0 +1,24 @@ | @@ -0,0 +1,24 @@ | ||
1 | +Feature: manage enterprises | ||
2 | + As a enterprise owner | ||
3 | + I want to manage my enterprises | ||
4 | + | ||
5 | + Background: | ||
6 | + Given the following users | ||
7 | + | login | name | | ||
8 | + | joaosilva | Joao Silva | | ||
9 | + | mariasilva | Joao Silva | | ||
10 | + And the following enterprise | ||
11 | + | identifier | name | owner | | ||
12 | + | tangerine-dream | Tangerine Dream | joaosilva | | ||
13 | + | ||
14 | + @selenium | ||
15 | + Scenario: seeing my enterprises on menu | ||
16 | + Given I am logged in as "joaosilva" | ||
17 | + Then I should see "My enterprises" link | ||
18 | + When I follow "My enterprises" and wait | ||
19 | + Then I should see "Tangerine Dream" linking to "/myprofile/tangerine-dream" | ||
20 | + | ||
21 | + @selenium | ||
22 | + Scenario: not show enterprises on menu to a user without enterprises | ||
23 | + Given I am logged in as "mariasilva" | ||
24 | + Then I should not see "My enterprises" link |
public/designs/themes/base/style.css
public/javascripts/application.js
@@ -300,7 +300,7 @@ function hideAllSubmenus() { | @@ -300,7 +300,7 @@ function hideAllSubmenus() { | ||
300 | 300 | ||
301 | // Hide visible ballons when clicked outside them | 301 | // Hide visible ballons when clicked outside them |
302 | jQuery(document).ready(function() { | 302 | jQuery(document).ready(function() { |
303 | - jQuery('body').click(function() { hideAllSubmenus(); }); | 303 | + jQuery('body').live('click', function() { hideAllSubmenus(); }); |
304 | jQuery('.menu-submenu-trigger').click(function(e) { e.stopPropagation(); }); | 304 | jQuery('.menu-submenu-trigger').click(function(e) { e.stopPropagation(); }); |
305 | jQuery('.simplemenu-trigger').click(function(e) { e.stopPropagation(); }); | 305 | jQuery('.simplemenu-trigger').click(function(e) { e.stopPropagation(); }); |
306 | jQuery('#chat-online-users').click(function(e) { e.stopPropagation(); }); | 306 | jQuery('#chat-online-users').click(function(e) { e.stopPropagation(); }); |
@@ -649,6 +649,10 @@ jQuery(function($) { | @@ -649,6 +649,10 @@ jQuery(function($) { | ||
649 | document.location.href = this.href; | 649 | document.location.href = this.href; |
650 | }) | 650 | }) |
651 | } | 651 | } |
652 | + $('#manage-enterprises-link').live('click', function() { | ||
653 | + toggleMenu(this); | ||
654 | + return false; | ||
655 | + }); | ||
652 | }); | 656 | }); |
653 | 657 | ||
654 | function add_comment_reply_form(button, comment_id) { | 658 | function add_comment_reply_form(button, comment_id) { |
public/stylesheets/application.css
@@ -966,6 +966,40 @@ code input { | @@ -966,6 +966,40 @@ code input { | ||
966 | overflow: hidden; | 966 | overflow: hidden; |
967 | } | 967 | } |
968 | 968 | ||
969 | +#manage-enterprises { | ||
970 | + display: inline-block; | ||
971 | + margin-right: 5px; | ||
972 | + position: relative; | ||
973 | +} | ||
974 | +#manage-enterprises .ui-icon { | ||
975 | + position: absolute; | ||
976 | + top: 0; | ||
977 | + right: -20px; | ||
978 | +} | ||
979 | +#manage-enterprises .simplemenu-submenu { | ||
980 | + text-align: left; | ||
981 | + left: -20px; | ||
982 | + width: 200px; | ||
983 | +} | ||
984 | +#manage-enterprises .simplemenu-item { | ||
985 | + padding: 5px 0; | ||
986 | +} | ||
987 | +#manage-enterprises .simplemenu-item a { | ||
988 | + background-repeat: no-repeat; | ||
989 | + padding-left: 20px; | ||
990 | +} | ||
991 | +#manage-enterprises .simplemenu-item a span { | ||
992 | + display: none; | ||
993 | +} | ||
994 | +.msie8 #manage-enterprises-link { /* IE8 hack */ | ||
995 | + border: 0px solid; | ||
996 | +} | ||
997 | +.msie8 #manage-enterprises .simplemenu-submenu { | ||
998 | + top: 16px; | ||
999 | +} | ||
1000 | +.webkit #manage-enterprises .simplemenu-submenu { | ||
1001 | + top: 20px; | ||
1002 | +} | ||
969 | 1003 | ||
970 | #article { | 1004 | #article { |
971 | position: relative; | 1005 | position: relative; |
@@ -5289,6 +5323,8 @@ h1#agenda-title { | @@ -5289,6 +5323,8 @@ h1#agenda-title { | ||
5289 | top: 20px; | 5323 | top: 20px; |
5290 | width: 120px; | 5324 | width: 120px; |
5291 | margin: 0; | 5325 | margin: 0; |
5326 | + display: none; | ||
5327 | + z-index: 100; | ||
5292 | } | 5328 | } |
5293 | .msie8 .simplemenu-submenu { | 5329 | .msie8 .simplemenu-submenu { |
5294 | top: 8px; | 5330 | top: 8px; |