Mercurial > code > home > repos > light9
changeset 1587:2c973af2b13e
refactor light9-device-settings settings table
Ignore-this: 7685c17a0a1c5f46764aeab8c181698a
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Tue, 30 May 2017 08:54:24 +0000 |
parents | 901767febb47 |
children | 9b46e38e2b0f |
files | light9/web/paint/paint-elements.coffee |
diffstat | 1 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/web/paint/paint-elements.coffee Tue May 30 08:39:05 2017 +0000 +++ b/light9/web/paint/paint-elements.coffee Tue May 30 08:54:24 2017 +0000 @@ -156,9 +156,21 @@ for s in @graph.objects(U(@subj), U(':setting')) attr = @graph.uriValue(s, U(':deviceAttr')) attrLabel = @graph.stringValue(attr, U('rdfs:label')) - @push('attrs', {attr: attrLabel, val: @graph.floatValue(s, U(':value'))}) - + @attrs.push({attr: attrLabel, val: @settingValue(s)}) + @attrs = _.sortBy(@attrs, 'attr') + settingValue: (s) -> + U = (x) => @graph.Uri(x) + for pred in [U(':value'), U(':scaledValue')] + try + return @graph.stringValue(s, pred) + catch + null + try + return @graph.floatValue(s, pred) + catch + null + throw new Error("no value for #{s}") Polymer is: "light9-paint"