diff options
author | Udo Walter | 2020-08-08 02:16:14 +0200 |
---|---|---|
committer | Udo Walter | 2020-08-08 02:16:14 +0200 |
commit | 6f00e70ecc3a707954e8888810bca34d114758bc (patch) | |
tree | 3a3f0b4a951544357d4a86d6aed84948261d81cb /src/main/resources/controllers/groupFieldController.js | |
parent | Reduce SPAM by using .debug() not .info() (diff) | |
download | bwlp-guacamole-ext-6f00e70ecc3a707954e8888810bca34d114758bc.tar.gz bwlp-guacamole-ext-6f00e70ecc3a707954e8888810bca34d114758bc.tar.xz bwlp-guacamole-ext-6f00e70ecc3a707954e8888810bca34d114758bc.zip |
Some UI changes:
- add double click to select location and continue
- add a preselected location (first one in the list without a password)
- add logo above the location selection
- remove redundant text at the bottom
- the logo is now customizable via the guacamole.properties file (property name: slx-logo-url)
Diffstat (limited to 'src/main/resources/controllers/groupFieldController.js')
-rw-r--r-- | src/main/resources/controllers/groupFieldController.js | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/main/resources/controllers/groupFieldController.js b/src/main/resources/controllers/groupFieldController.js index ce80854..7dc1612 100644 --- a/src/main/resources/controllers/groupFieldController.js +++ b/src/main/resources/controllers/groupFieldController.js @@ -1,6 +1,14 @@ -angular.module('group').controller('groupFieldController', ['$scope', function groupFieldController($scope) { +angular.module('group').controller('groupFieldController', ['$scope', function groupFieldController($scope, $http) { - $scope.data = { id: 0, password: '', resolution: window.innerWidth + 'x' + window.innerHeight }; + $scope.data = {id: 0, password: '', resolution: window.innerWidth + 'x' + window.innerHeight}; + + // Preselect the first location without a password + if ($scope.field && $scope.field.groups && Array.isArray($scope.field.groups)) { + for (let i in $scope.field.groups) { + let group = $scope.field.groups[i]; + if (!group.password) $scope.data.id = group.id; + } + } $scope.$watch('data', function(newValue) { if (window.location.hash !== '#/') { @@ -12,17 +20,15 @@ angular.module('group').controller('groupFieldController', ['$scope', function g $scope.selectGroup = function selectGroup($event, id) { if (angular.element($event.target).hasClass('bwlp-password-input')) return; - $scope.data.password = ''; - if ($scope.data.id === id) { - $scope.data.id = 0; - angular.element('.selected-group').removeClass('selected-group'); - return; - } + if ($scope.data.id !== id) $scope.data.password = ''; $scope.data.id = id; - angular.element('.selected-group').removeClass('selected-group'); - angular.element($event.currentTarget).addClass('selected-group'); }; + $scope.submitGroup = function submitGroup($event, id) { + $scope.selectGroup($event, id); + angular.element($event.currentTarget.closest('form')).scope().login(); + } + $scope.logout = function logout() { window.localStorage.removeItem('GUAC_AUTH'); window.location.hash = '#/'; |