summaryrefslogtreecommitdiffstats
path: root/src/main/resources/controllers/locationFieldController.js
diff options
context:
space:
mode:
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