summaryrefslogtreecommitdiffstats
path: root/src/main/resources/controllers/locationFieldController.js
diff options
context:
space:
mode:
authorUdo Walter2020-05-07 19:30:48 +0200
committerUdo Walter2020-05-07 19:30:48 +0200
commit90f06cbe0b2ff3b1a9d85d2f73fe5864e692341b (patch)
tree17139070c9ac144f9cd214a01e4af5e86a895dbe /src/main/resources/controllers/locationFieldController.js
parentPrevent user from sticking to connection if it was reset. (diff)
downloadbwlp-guacamole-ext-90f06cbe0b2ff3b1a9d85d2f73fe5864e692341b.tar.gz
bwlp-guacamole-ext-90f06cbe0b2ff3b1a9d85d2f73fe5864e692341b.tar.xz
bwlp-guacamole-ext-90f06cbe0b2ff3b1a9d85d2f73fe5864e692341b.zip
Add location selection
Diffstat (limited to 'src/main/resources/controllers/locationFieldController.js')
-rw-r--r--src/main/resources/controllers/locationFieldController.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/resources/controllers/locationFieldController.js b/src/main/resources/controllers/locationFieldController.js
new file mode 100644
index 0000000..8117ed7
--- /dev/null
+++ b/src/main/resources/controllers/locationFieldController.js
@@ -0,0 +1,23 @@
+angular.module('location').controller('locationFieldController', ['$scope', '$window',
+ function locationFieldController($scope, $window) {
+
+ $scope.data = { id: 0, password: '' }
+
+ $scope.$watch('data', function(newValue) {
+ $scope.model = JSON.stringify(newValue);
+ }, true);
+
+ $scope.selectLocation = function selectLocation($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-location').removeClass('selected-location');
+ return;
+ }
+ $scope.data.id = id;
+ angular.element('.selected-location').removeClass('selected-location');
+ angular.element($event.currentTarget).addClass('selected-location');
+ };
+
+}]); \ No newline at end of file