mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-1120: Display menu options as disabled if they are not relevant. Navigate explicitly via click event, in case browser depends on click propagation to handle href, but keep href for sake of "open in new tab", etc.
This commit is contained in:
@@ -80,6 +80,23 @@ angular.module('userMenu').directive('guacUserMenu', [function guacUserMenu() {
|
||||
*/
|
||||
var document = $document[0];
|
||||
|
||||
/**
|
||||
* Whether the option to go to the home screen is disabled.
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
$scope.homeDisabled = ($location.path() === '/');
|
||||
|
||||
/**
|
||||
* Whether the option to go to the management interface is
|
||||
* disabled. Note that shis is different from canManageGuacamole,
|
||||
* which deals with whether permission to manage is granted. A user
|
||||
* may have permission, yet see this option as currently disabled.
|
||||
*
|
||||
* @type Boolean
|
||||
*/
|
||||
$scope.manageDisabled = ($location.path() === '/manage/');
|
||||
|
||||
/**
|
||||
* Whether the current user has sufficient permissions to use the
|
||||
* management interface. If permissions have not yet been loaded,
|
||||
@@ -263,13 +280,27 @@ angular.module('userMenu').directive('guacUserMenu', [function guacUserMenu() {
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Navigates to the home screen.
|
||||
*/
|
||||
$scope.navigateHome = function navigateHome() {
|
||||
$location.path('/');
|
||||
};
|
||||
|
||||
/**
|
||||
* Navigates to the management interface.
|
||||
*/
|
||||
$scope.manage = function manage() {
|
||||
$location.path('/manage/');
|
||||
};
|
||||
|
||||
/**
|
||||
* Logs out the current user, redirecting them to back to the login
|
||||
* screen after logout completes.
|
||||
*/
|
||||
$scope.logout = function logout() {
|
||||
authenticationService.logout()['finally'](function logoutComplete() {
|
||||
$location.path('/login');
|
||||
$location.path('/login/');
|
||||
});
|
||||
};
|
||||
|
||||
|
@@ -169,7 +169,14 @@
|
||||
}
|
||||
|
||||
.user-menu .options li a:hover {
|
||||
background: #CDA;
|
||||
background-color: #CDA;
|
||||
}
|
||||
|
||||
.user-menu .options li a.disabled,
|
||||
.user-menu .options li a.disabled:hover {
|
||||
background-color: transparent;
|
||||
cursor: default;
|
||||
opacity: 0.25;
|
||||
}
|
||||
|
||||
.user-menu .options li a.home,
|
||||
|
@@ -27,10 +27,35 @@
|
||||
|
||||
<!-- Menu options -->
|
||||
<ul class="options">
|
||||
<li><a class="home" href="#/">{{'USER_MENU.ACTION_NAVIGATE_HOME' | translate}}</a></li>
|
||||
<li><a class="manage" ng-show="canManageGuacamole" href="#/manage/">{{'USER_MENU.ACTION_MANAGE' | translate}}</a></li>
|
||||
<li><a class="change-password" ng-click="showPasswordUpdate()" ng-show="canChangePassword">{{'USER_MENU.ACTION_CHANGE_PASSWORD' | translate}}</a></li>
|
||||
<li><a class="logout" ng-click="logout()">{{'USER_MENU.ACTION_LOGOUT' | translate}}</a></li>
|
||||
|
||||
<!-- Home -->
|
||||
<li>
|
||||
<a class="home" ng-click="navigateHome()" ng-class="{disabled: homeDisabled}" href="#/">
|
||||
{{'USER_MENU.ACTION_NAVIGATE_HOME' | translate}}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- Manage -->
|
||||
<li>
|
||||
<a class="manage" ng-click="manage()" ng-class="{disabled: manageDisabled}" ng-show="canManageGuacamole" href="#/manage/">
|
||||
{{'USER_MENU.ACTION_MANAGE' | translate}}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- Change password -->
|
||||
<li>
|
||||
<a class="change-password" ng-click="showPasswordUpdate()" ng-show="canChangePassword">
|
||||
{{'USER_MENU.ACTION_CHANGE_PASSWORD' | translate}}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- Logout -->
|
||||
<li>
|
||||
<a class="logout" ng-click="logout()">
|
||||
{{'USER_MENU.ACTION_LOGOUT' | translate}}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
Reference in New Issue
Block a user