diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-10-31 12:04:28 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-10-31 12:04:28 +0100 |
commit | 02d6e77bd180cbbf6f7f6e1a69c670e922d8204d (patch) | |
tree | c55847b71e589f79ce6537f2b61f3691fe8bf220 /web/static/app/app.js | |
parent | dd72e7992f126c4a42a0791228400738072f297d (diff) | |
download | diller-server-02d6e77bd180cbbf6f7f6e1a69c670e922d8204d.tar.gz diller-server-02d6e77bd180cbbf6f7f6e1a69c670e922d8204d.tar.bz2 diller-server-02d6e77bd180cbbf6f7f6e1a69c670e922d8204d.tar.xz diller-server-02d6e77bd180cbbf6f7f6e1a69c670e922d8204d.zip |
web:
o Starting on edit button for device name.
Diffstat (limited to 'web/static/app/app.js')
-rw-r--r-- | web/static/app/app.js | 29 |
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) |