From 803148d5a23afe207fb5de9ac73c986a324feb9c Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 31 Oct 2015 14:09:39 +0100 Subject: core: o Improved transaction handling. web: o Supporting changing a device's name and description. --- web/static/app/app.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'web/static/app/app.js') diff --git a/web/static/app/app.js b/web/static/app/app.js index 134afc8..fedfb54 100644 --- a/web/static/app/app.js +++ b/web/static/app/app.js @@ -17,15 +17,18 @@ var ctrl = this; ctrl.attributeName = attributeName; + ctrl.label = attributeName.substr(0, 1).toUpperCase() + attributeName.substr(1); ctrl.value = outer.device[attributeName]; - ctrl.value = 'yoyo'; + ctrl.error = 'fail'; ctrl.update = function () { - DillerRpc.patchDevice(outer.device.id, {attribute: attributeName, value: ctrl.value}) .then(function (res) { + outer.device = res.data.device; $uibModalInstance.close({}); + }, function (res) { + ctrl.error = res.data.message; }); }; }, @@ -69,7 +72,6 @@ } function DlTimestampDirective() { - console.log('DlTimestampDirective', DlTimestampDirective); return { restrict: 'E', scope: { @@ -123,12 +125,14 @@ }); } + function run($log) { + window.console = $log; + } + function DillerConfig() { var head = document.getElementsByTagName('head')[0]; var base = head.getElementsByTagName('base')[0]; - console.log('base =', base); var baseUrl = base.href.replace(/\/$/, ''); - console.log('baseUrl =', baseUrl); return { baseUrl: baseUrl }; @@ -137,6 +141,7 @@ angular .module('Diller', ['ngRoute', 'ui.bootstrap']) .config(config) + .run(run) .filter('timestamp', TimestampFilter) .directive('dlTimestamp', DlTimestampDirective) .directive('dlDots', DlDotsDirective) -- cgit v1.2.3