Commit dfcb10be authored by Hannah Stepanek's avatar Hannah Stepanek

Add showGroupsMenu to group list controller

Use showGroupsMenu to decide when to show drop down
parent c5488135
...@@ -75,6 +75,10 @@ function GroupListController($window, analytics, groups, settings, serviceUrl) { ...@@ -75,6 +75,10 @@ function GroupListController($window, analytics, groups, settings, serviceUrl) {
} }
this.isThirdPartyService = isThirdPartyService(settings); this.isThirdPartyService = isThirdPartyService(settings);
this.showGroupsMenu = () => {
return !( this.isThirdPartyService && (this.groups.all().length <= 1) );
};
} }
module.exports = { module.exports = {
......
<div class="pull-right" <div class="pull-right"
dropdown dropdown
keyboard-nav> keyboard-nav>
<!-- Show a drop down menu if showGroupsMenu is true. -->
<div class="dropdown-toggle" <div class="dropdown-toggle"
dropdown-toggle dropdown-toggle
data-toggle="dropdown" data-toggle="dropdown"
role="button" role="button"
title="Change the selected group"> title="Change the selected group" ng-if="vm.showGroupsMenu()">
<img class="group-list-label__icon group-list-label__icon--organization" <img class="group-list-label__icon group-list-label__icon--organization"
ng-src="{{ vm.focusedIcon() }}" ng-src="{{ vm.focusedIcon() }}"
alt="{{ vm.orgName(vm.groups.focused().id)}}" alt="{{ vm.orgName(vm.groups.focused().id)}}"
...@@ -15,8 +16,23 @@ ...@@ -15,8 +16,23 @@
!--><span class="group-list-label__label">{{vm.groups.focused().name}}</span><!-- nospace !--><span class="group-list-label__label">{{vm.groups.focused().name}}</span><!-- nospace
!--><i class="h-icon-arrow-drop-down"></i> !--><i class="h-icon-arrow-drop-down"></i>
</div> </div>
<div class="dropdown-menu__top-arrow"></div> <!-- Do not show a drop down menu if showGroupsMenu is false. -->
<ul class="dropdown-menu pull-none" role="menu"> <div class="dropdown-toggle"
dropdown-toggle
role="header"
aria-level="2"
title="Selected group" ng-if="!vm.showGroupsMenu()">
<img class="group-list-label__icon group-list-label__icon--organization"
ng-src="{{ vm.focusedIcon() }}"
alt="{{ vm.orgName(vm.groups.focused().id)}}"
ng-if="vm.focusedIcon()">
<i class="group-list-label__icon h-icon-{{ vm.focusedIconClass() }}"
ng-if="!vm.focusedIcon()"></i><!-- nospace
!--><span class="group-list-label__label">{{vm.groups.focused().name}}</span>
</div>
<!-- Only build the drop down menu if showGroupsMenu is true. -->
<div class="dropdown-menu__top-arrow" ng-if="vm.showGroupsMenu()"></div>
<ul class="dropdown-menu pull-none" role="menu" ng-if="vm.showGroupsMenu()">
<li class="dropdown-menu__row dropdown-menu__row--unpadded " <li class="dropdown-menu__row dropdown-menu__row--unpadded "
ng-repeat="group in vm.groupOrganizations() track by group.id"> ng-repeat="group in vm.groupOrganizations() track by group.id">
<div ng-class="{'group-item': true, selected: group.id == vm.groups.focused().id}" <div ng-class="{'group-item': true, selected: group.id == vm.groups.focused().id}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment