# HG changeset patch # User Drew Perttula # Date 2017-05-30 08:54:24 # Node ID 2c973af2b13ec632e04f3597af84bb877406c64a # Parent 901767febb47bb44b27fad8b8b4555acebe55620 refactor light9-device-settings settings table Ignore-this: 7685c17a0a1c5f46764aeab8c181698a diff --git a/light9/web/paint/paint-elements.coffee b/light9/web/paint/paint-elements.coffee --- a/light9/web/paint/paint-elements.coffee +++ b/light9/web/paint/paint-elements.coffee @@ -156,9 +156,21 @@ Polymer 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"