From e460fde6ed73a5576c56c2a78f7d4b4165dda741 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 7 Apr 2015 22:49:41 -0700 Subject: [PATCH] GUAC-1126: Add client-specific disconnect action to menu. Style with danger. --- .../client/controllers/clientController.js | 13 ++++++++ .../main/webapp/app/client/styles/client.css | 10 +++++- .../main/webapp/app/client/styles/menu.css | 31 ------------------ .../webapp/app/client/templates/client.html | 3 +- .../app/navigation/directives/guacUserMenu.js | 10 ++++++ .../app/navigation/styles/user-menu.css | 10 ++++++ .../navigation/templates/guacUserMenu.html | 7 ++++ guacamole/src/main/webapp/images/x-shadow.png | Bin 839 -> 0 bytes guacamole/src/main/webapp/images/x.png | Bin 0 -> 591 bytes 9 files changed, 50 insertions(+), 34 deletions(-) delete mode 100644 guacamole/src/main/webapp/images/x-shadow.png create mode 100644 guacamole/src/main/webapp/images/x.png diff --git a/guacamole/src/main/webapp/app/client/controllers/clientController.js b/guacamole/src/main/webapp/app/client/controllers/clientController.js index 7faa9c758..5986fdfe1 100644 --- a/guacamole/src/main/webapp/app/client/controllers/clientController.js +++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js @@ -544,6 +544,19 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams }; + /** + * Action which immediately disconnects the currently-connected client, if + * any. + */ + var DISCONNECT_MENU_ACTION = { + name : 'CLIENT.ACTION_DISCONNECT', + className : 'danger disconnect', + callback : $scope.disconnect + }; + + // Set client-specific menu actions + $scope.clientMenuActions = [ DISCONNECT_MENU_ACTION ]; + // Clean up when view destroyed $scope.$on('$destroy', function clientViewDestroyed() { diff --git a/guacamole/src/main/webapp/app/client/styles/client.css b/guacamole/src/main/webapp/app/client/styles/client.css index db405fff1..8dde10db0 100644 --- a/guacamole/src/main/webapp/app/client/styles/client.css +++ b/guacamole/src/main/webapp/app/client/styles/client.css @@ -117,4 +117,12 @@ body.client { width: auto; height: auto; -} \ No newline at end of file +} + +.client .user-menu .options li a.disconnect { + background-repeat: no-repeat; + background-size: 1em; + background-position: 0.75em center; + padding-left: 2.5em; + background-image: url('images/x.png'); +} diff --git a/guacamole/src/main/webapp/app/client/styles/menu.css b/guacamole/src/main/webapp/app/client/styles/menu.css index 3895d6324..c35949f01 100644 --- a/guacamole/src/main/webapp/app/client/styles/menu.css +++ b/guacamole/src/main/webapp/app/client/styles/menu.css @@ -81,37 +81,6 @@ } -.menu-content .header button.close { - - margin: 0 0.75em; - padding: 0; - width: 1.5em; - height: 1.5em; - min-width: 0; - - box-shadow: none; - -moz-border-radius: 1.5em; - -webkit-border-radius: 1.5em; - -khtml-border-radius: 1.5em; - border-radius: 1.5em; - - -moz-background-size: 0.75em; - -webkit-background-size: 0.75em; - -khtml-background-size: 0.75em; - background-size: 0.75em; - - background-image: url('images/x-shadow.png'); - background-repeat: no-repeat; - background-position: center; - - vertical-align: middle; - -ms-flex-align-self: center; - -moz-align-self: center; - -webkit-align-self: center; - align-self: center; - -} - .menu-body { -ms-flex: 1 1 auto; diff --git a/guacamole/src/main/webapp/app/client/templates/client.html b/guacamole/src/main/webapp/app/client/templates/client.html index 8cb709c36..01e0fa547 100644 --- a/guacamole/src/main/webapp/app/client/templates/client.html +++ b/guacamole/src/main/webapp/app/client/templates/client.html @@ -59,8 +59,7 @@

{{client.name}}

- - +
diff --git a/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js b/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js index d5fd0a901..1868cda06 100644 --- a/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js +++ b/guacamole/src/main/webapp/app/navigation/directives/guacUserMenu.js @@ -30,6 +30,16 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu() restrict: 'E', replace: true, scope: { + + /** + * Optional array of actions which are specific to this particular + * location, as these actions may not be appropriate for other + * locations which contain the user menu. + * + * @type MenuAction[] + */ + localActions : '=' + }, templateUrl: 'app/navigation/templates/guacUserMenu.html', diff --git a/guacamole/src/main/webapp/app/navigation/styles/user-menu.css b/guacamole/src/main/webapp/app/navigation/styles/user-menu.css index 9c331fbcd..ba54e150d 100644 --- a/guacamole/src/main/webapp/app/navigation/styles/user-menu.css +++ b/guacamole/src/main/webapp/app/navigation/styles/user-menu.css @@ -215,6 +215,16 @@ background-image: url('images/action-icons/guac-logout-dark.png'); } +.user-menu .options li a.danger { + color: white; + font-weight: bold; + background-color: #A43; +} + +.user-menu .options li a.danger:hover { + background-color: #C54; +} + .user-menu .password-dialog { visibility: hidden; opacity: 0; diff --git a/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html b/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html index fa287ac71..564d95173 100644 --- a/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html +++ b/guacamole/src/main/webapp/app/navigation/templates/guacUserMenu.html @@ -28,6 +28,13 @@