diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 66404d7..8a053fa 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1104,6 +1104,15 @@ module ApplicationHelper result end + def manage_enterprises + if user && !user.enterprises.empty? + enterprises_link = user.enterprises.map do |enterprise| + link_to(content_tag('strong', [_('Manage %s') % enterprise.short_name(25)]), "/myprofile/#{enterprise.identifier}", :class => "icon-menu-enterprise", :title => [_('Manage %s') % enterprise.short_name]) + end + render :partial => 'shared/manage_enterprises', :locals => {:enterprises_link => enterprises_link} + end + end + def usermenu_logged_in pending_tasks_count = '' if user && user.all_pending_tasks.count > 0 @@ -1113,6 +1122,7 @@ module ApplicationHelper (_('Welcome, %s') % link_to('{login}', '/{login}', :id => "homepage-link", :title => _('Go to your homepage'))) + render_environment_features(:usermenu) + link_to('' + _('Administration') + '', { :controller => 'admin_panel', :action => 'index' }, :id => "controlpanel", :title => _("Configure the environment"), :class => 'admin-link', :style => 'display: none') + + manage_enterprises.to_s + link_to('' + _('Control panel') + '', '/myprofile/{login}', :id => "controlpanel", :title => _("Configure your personal account and content")) + pending_tasks_count + link_to('' + _('Logout') + '', { :controller => 'account', :action => 'logout'} , :id => "logout", :title => _("Leave the system")) diff --git a/app/views/shared/_manage_enterprises.rhtml b/app/views/shared/_manage_enterprises.rhtml new file mode 100644 index 0000000..5e4a895 --- /dev/null +++ b/app/views/shared/_manage_enterprises.rhtml @@ -0,0 +1,8 @@ +
+ '><%= ui_icon('ui-icon-triangle-1-s') + _('My enterprises') %> + +
diff --git a/features/manage_enterprises.feature b/features/manage_enterprises.feature new file mode 100644 index 0000000..070fd46 --- /dev/null +++ b/features/manage_enterprises.feature @@ -0,0 +1,24 @@ +Feature: manage enterprises + As a enterprise owner + I want to manage my enterprises + + Background: + Given the following users + | login | name | + | joaosilva | Joao Silva | + | mariasilva | Joao Silva | + And the following enterprise + | identifier | name | owner | + | tangerine-dream | Tangerine Dream | joaosilva | + + @selenium + Scenario: seeing my enterprises on menu + Given I am logged in as "joaosilva" + Then I should see "My enterprises" link + When I follow "My enterprises" and wait + Then I should see "Tangerine Dream" linking to "/myprofile/tangerine-dream" + + @selenium + Scenario: not show enterprises on menu to a user without enterprises + Given I am logged in as "mariasilva" + Then I should not see "My enterprises" link diff --git a/public/designs/themes/base/style.css b/public/designs/themes/base/style.css index cedd006..d639a82 100644 --- a/public/designs/themes/base/style.css +++ b/public/designs/themes/base/style.css @@ -86,7 +86,7 @@ body, th, td, input { color: #555753; } -#controlpanel, #logout, #openchat { +#controlpanel, #logout, #openchat, #manage-enterprises { margin-left: 25px; } diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 7369c39..438eb39 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -300,7 +300,7 @@ function hideAllSubmenus() { // Hide visible ballons when clicked outside them jQuery(document).ready(function() { - jQuery('body').click(function() { hideAllSubmenus(); }); + jQuery('body').live('click', function() { hideAllSubmenus(); }); jQuery('.menu-submenu-trigger').click(function(e) { e.stopPropagation(); }); jQuery('.simplemenu-trigger').click(function(e) { e.stopPropagation(); }); jQuery('#chat-online-users').click(function(e) { e.stopPropagation(); }); @@ -649,6 +649,10 @@ jQuery(function($) { document.location.href = this.href; }) } + $('#manage-enterprises-link').live('click', function() { + toggleMenu(this); + return false; + }); }); function add_comment_reply_form(button, comment_id) { diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 48252db..1bc6b0a 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -966,6 +966,40 @@ code input { overflow: hidden; } +#manage-enterprises { + display: inline-block; + margin-right: 5px; + position: relative; +} +#manage-enterprises .ui-icon { + position: absolute; + top: 0; + right: -20px; +} +#manage-enterprises .simplemenu-submenu { + text-align: left; + left: -20px; + width: 200px; +} +#manage-enterprises .simplemenu-item { + padding: 5px 0; +} +#manage-enterprises .simplemenu-item a { + background-repeat: no-repeat; + padding-left: 20px; +} +#manage-enterprises .simplemenu-item a span { + display: none; +} +.msie8 #manage-enterprises-link { /* IE8 hack */ + border: 0px solid; +} +.msie8 #manage-enterprises .simplemenu-submenu { + top: 16px; +} +.webkit #manage-enterprises .simplemenu-submenu { + top: 20px; +} #article { position: relative; @@ -5289,6 +5323,8 @@ h1#agenda-title { top: 20px; width: 120px; margin: 0; + display: none; + z-index: 100; } .msie8 .simplemenu-submenu { top: 8px; -- libgit2 0.21.2