Mercurial > code > home > repos > homeauto
comparison service/arduinoNode/static/index.html @ 173:0daa8cbbd8f6
handle compact/full uris better, but still not always right
Ignore-this: 10d98f16a659f899528eb86411473b18
author | drewp@bigasterisk.com |
---|---|
date | Fri, 17 Apr 2015 02:00:15 -0700 |
parents | 4d2df276baae |
children | fc5fdcc3ed4a |
comparison
equal
deleted
inserted
replaced
172:715c1c42185e | 173:0daa8cbbd8f6 |
---|---|
22 room: 'http://projects.bigasterisk.com/room/', | 22 room: 'http://projects.bigasterisk.com/room/', |
23 rdfs: 'http://www.w3.org/2000/01/rdf-schema#', | 23 rdfs: 'http://www.w3.org/2000/01/rdf-schema#', |
24 }; | 24 }; |
25 </script> | 25 </script> |
26 | 26 |
27 <script> | |
28 PolymerExpressions.prototype.tojson = function(input) { | |
29 return JSON.stringify(input); | |
30 }; | |
31 | |
32 // not well defined for uri prefixes that are string prefixes of each other | |
33 PolymerExpressions.prototype.compactUri = function(uri) { | |
34 if (uri === undefined) { | |
35 return uri; | |
36 } | |
37 for (var short of Object.keys(window.NS)) { | |
38 var prefix = window.NS[short]; | |
39 if (uri.indexOf(prefix) == 0) { | |
40 return short + ':' + uri.substr(prefix.length); | |
41 } | |
42 } | |
43 return uri; | |
44 }; | |
45 </script> | |
46 | |
27 <polymer-element name="linked-uri" noscript attributes="href"> | 47 <polymer-element name="linked-uri" noscript attributes="href"> |
28 <template> | 48 <template> |
29 <a href="{{href}}">{{href}}</a> | 49 <a href="{{href}}">{{href}}</a> |
50 </template> | |
51 </polymer-element> | |
52 | |
53 <!-- subj/pred are compact uris --> | |
54 <polymer-element name="watched-subgraph" noscript attributes="subj pred"> | |
55 <template> | |
56 <style> | |
57 .read { font-weight: bold; } | |
58 </style> | |
59 | |
60 <rdf-observe | |
61 graph="http://dash:9059/graph" xtodo="get host here" | |
62 subject="{{subj}}" | |
63 predicate="{{pred}}" | |
64 out="{{out}}"> | |
65 </rdf-observe> | |
66 | |
67 <div>{{subj}}, {{pred}}, | |
68 <span class="read">{{out[pred]['@value']}}</span> | |
69 </div> | |
70 | |
30 </template> | 71 </template> |
31 </polymer-element> | 72 </polymer-element> |
32 | 73 |
33 <polymer-element name="arduinonode-boards" noscript> | 74 <polymer-element name="arduinonode-boards" noscript> |
34 <template> | 75 <template> |
73 | 114 |
74 <template if="{{dev.watchPrefixes.length}}"> | 115 <template if="{{dev.watchPrefixes.length}}"> |
75 <div>watching:</div> | 116 <div>watching:</div> |
76 <ul> | 117 <ul> |
77 <template repeat="{{prefix in dev.watchPrefixes}}"> | 118 <template repeat="{{prefix in dev.watchPrefixes}}"> |
78 | 119 <watched-subgraph |
79 <!-- | 120 subj="{{prefix[0] | compactUri}}" |
80 <rdf-observe | 121 pred="{{prefix[1] | compactUri}}"></watched-subgraph> |
81 graph="http://dash:9059/graph" xtodo="get host here" | |
82 subject="{{prefix[0]}}" | |
83 predicate="{{prefix[1]}}" | |
84 out="{{out}}"> | |
85 </rdf-observe> | |
86 | |
87 <div>{{prefix[0]}}, {{prefix[1]}}, {{out['room:temperatureF']['@value']}}</div> | |
88 --> | |
89 </template> | 122 </template> |
90 </ul> | 123 </ul> |
91 </template> | 124 </template> |
92 | 125 |
93 <template if="{{dev.outputWidgets.length}}"> | 126 <template if="{{dev.outputWidgets.length}}"> |