mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUAC-586: Do not show tab levels which have only one tab.
This commit is contained in:
@@ -146,17 +146,6 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
|||||||
*/
|
*/
|
||||||
$scope.accountPages = [];
|
$scope.accountPages = [];
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the list of all available account tabs should be shown.
|
|
||||||
*
|
|
||||||
* @returns {Boolean}
|
|
||||||
* true if the list of available account tabs should be shown, false
|
|
||||||
* otherwise.
|
|
||||||
*/
|
|
||||||
$scope.showAccountTabs = function showAccountTabs() {
|
|
||||||
return !!$scope.accountPages && $scope.accountPages.length > 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether critical data has completed being loaded.
|
* Returns whether critical data has completed being loaded.
|
||||||
*
|
*
|
||||||
|
@@ -28,7 +28,7 @@ THE SOFTWARE.
|
|||||||
<guac-user-menu></guac-user-menu>
|
<guac-user-menu></guac-user-menu>
|
||||||
</div>
|
</div>
|
||||||
<div class="page-tabs">
|
<div class="page-tabs">
|
||||||
<guac-page-list pages="accountPages" ng-show="showAccountTabs()"></guac-page-list>
|
<guac-page-list pages="accountPages"></guac-page-list>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Warn if user is read-only -->
|
<!-- Warn if user is read-only -->
|
||||||
|
@@ -223,6 +223,24 @@ angular.module('navigation').directive('guacPageList', [function guacPageList()
|
|||||||
// Add all page definitions
|
// Add all page definitions
|
||||||
angular.forEach(pages, addPage);
|
angular.forEach(pages, addPage);
|
||||||
|
|
||||||
|
// Filter to only relevant levels
|
||||||
|
$scope.levels = $scope.levels.filter(function isRelevant(level) {
|
||||||
|
|
||||||
|
// Determine relevancy by counting the number of pages
|
||||||
|
var pageCount = 0;
|
||||||
|
for (var name in level) {
|
||||||
|
|
||||||
|
// Level is relevant if it has two or more pages
|
||||||
|
if (++pageCount === 2)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, the level is not relevant
|
||||||
|
return false;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}] // end controller
|
}] // end controller
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<div class="page-list">
|
<div class="page-list" ng-show="levels.length">
|
||||||
<!--
|
<!--
|
||||||
Copyright (C) 2015 Glyptodon LLC
|
Copyright (C) 2015 Glyptodon LLC
|
||||||
|
|
||||||
|
@@ -46,17 +46,6 @@ angular.module('manage').controller('settingsController', ['$scope', '$injector'
|
|||||||
*/
|
*/
|
||||||
$scope.activeTab = $routeParams.tab;
|
$scope.activeTab = $routeParams.tab;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether the list of all available settings tabs should be shown.
|
|
||||||
*
|
|
||||||
* @returns {Boolean}
|
|
||||||
* true if the list of available settings tabs should be shown, false
|
|
||||||
* otherwise.
|
|
||||||
*/
|
|
||||||
$scope.showAvailableTabs = function showAvailableTabs() {
|
|
||||||
return !!$scope.settingsPages && $scope.settingsPages.length > 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Retrieve settings pages
|
// Retrieve settings pages
|
||||||
userPageService.getSettingsPages()
|
userPageService.getSettingsPages()
|
||||||
.then(function settingsPagesRetrieved(pages) {
|
.then(function settingsPagesRetrieved(pages) {
|
||||||
|
@@ -29,7 +29,7 @@ THE SOFTWARE.
|
|||||||
|
|
||||||
<!-- Available tabs -->
|
<!-- Available tabs -->
|
||||||
<div class="page-tabs">
|
<div class="page-tabs">
|
||||||
<guac-page-list pages="settingsPages" ng-show="showAvailableTabs()"></guac-page-list>
|
<guac-page-list pages="settingsPages"></guac-page-list>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Selected tab -->
|
<!-- Selected tab -->
|
||||||
|
Reference in New Issue
Block a user