aboutsummaryrefslogtreecommitdiff
path: root/web/static/app/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/static/app/app.js')
-rw-r--r--web/static/app/app.js29
1 files changed, 27 insertions, 2 deletions
diff --git a/web/static/app/app.js b/web/static/app/app.js
index 6fa1f71..134afc8 100644
--- a/web/static/app/app.js
+++ b/web/static/app/app.js
@@ -5,10 +5,35 @@
ctrl.devices = devices.data.devices;
}
- function DeviceController(device) {
+ function DeviceController($uibModal, device, DillerRpc) {
var ctrl = this;
ctrl.device = device.data.device;
+
+ ctrl.editDeviceAttribute = function (attributeName) {
+ var outer = ctrl;
+ $uibModal.open({
+ controller: function ($uibModalInstance) {
+ var ctrl = this;
+
+ ctrl.attributeName = attributeName;
+ ctrl.value = outer.device[attributeName];
+
+ ctrl.value = 'yoyo';
+
+ ctrl.update = function () {
+
+ DillerRpc.patchDevice(outer.device.id, {attribute: attributeName, value: ctrl.value})
+ .then(function (res) {
+ $uibModalInstance.close({});
+ });
+ };
+ },
+ controllerAs: 'ctrl',
+ bindToController: true,
+ templateUrl: 'app/templates/device-edit-attribute.modal.html'
+ });
+ }
}
function PropertyController($timeout, $route, DillerRpc, device, values) {
@@ -110,7 +135,7 @@
}
angular
- .module('Diller', ['ngRoute'])
+ .module('Diller', ['ngRoute', 'ui.bootstrap'])
.config(config)
.filter('timestamp', TimestampFilter)
.directive('dlTimestamp', DlTimestampDirective)