Mercurial > code > home > repos > homeauto
annotate service/arduinoNode/static/output-widgets.html @ 198:06795f84fe29
arduinoNode config. missing import
Ignore-this: d2fb9c1c35ff9b30f0b7b0ee67342821
author | drewp@bigasterisk.com |
---|---|
date | Sun, 04 Oct 2015 04:15:57 -0700 |
parents | 960b3b4cdd29 |
children | f8ffb9d8d982 |
rev | line source |
---|---|
193 | 1 <link rel="import" href="/lib/polymer/1.0.9/iron-ajax/iron-ajax.html"> |
2 <link rel="import" href="/lib/polymer/1.0.9/polymer/polymer.html"> | |
3 <link rel="import" href="/lib/polymer/1.0.9/color-picker-element/dist/color-picker.html"> | |
4 <link rel="import" href="/room/ari/static/rdf-uri.html"> | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
5 |
193 | 6 <dom-module id="output-sender"> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
7 <template> |
193 | 8 <iron-ajax id="output" url="../output" method="PUT"></iron-ajax> |
9 Set <a href$="{{subj}}">{{compactUri(subj)}}</a>'s | |
10 <span>{{compactUri(pred)}}</span> to | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
11 </template> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
12 <script> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
13 Polymer({ |
193 | 14 is: 'output-sender', |
15 behaviors: [BigastUri], | |
16 properties: { | |
17 subj: { notify: true }, | |
18 pred: { notify: true }, | |
19 value: { observer: 'valueChanged' } | |
20 }, | |
21 valueChanged: function () { | |
22 if (!this.subj || !this.pred) { | |
23 return; | |
24 } | |
187
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
25 //this.$.output.headers = {'content-type': ...} |
193 | 26 this.$.output.params = {s: this.subj, p: this.pred}; |
187
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
27 this.$.output.body = this.value; |
193 | 28 this.$.output.generateRequest(); |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
29 } |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
30 }); |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
31 </script> |
193 | 32 </dom-module> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
33 |
193 | 34 <dom-module id="output-rgb"> |
187
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
35 <template> |
193 | 36 <output-sender subj="{{subj}}" pred="{{pred}}" value="{{value}}"></output-sender> |
187
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
37 <color-picker id="pick" width="200" height="100" color="{{value}}"></color-picker> |
193 | 38 color pick <span>{{value}}</span> |
39 <button on-click="black">Black</button> | |
40 <button on-click="white">White</button> | |
41 </template> | |
42 <script> | |
43 Polymer({ | |
44 is: 'output-rgb', | |
45 properties: { | |
46 value: { notify: true }, | |
47 }, | |
48 ready: function () { | |
49 this.$.pick.addEventListener('colorselected', function (ev) { | |
50 this.value = ev.detail.hex; | |
51 }.bind(this)); | |
52 }, | |
53 black: function() {this.value = "#000000";}, | |
54 white: function() {this.value = "#ffffff";} | |
55 }); | |
56 </script> | |
57 </dom-module> | |
58 | |
59 <dom-module id="output-slider"> | |
60 <template> | |
61 <output-sender subj="{{subj}}" pred="{{pred}}" value="{{value}}"></output-sender> | |
62 <input type="range" min="{{min}}" max="{{max}}" step="{{step}}" value="{{value::input}}"> <span>{{value}}</span> | |
187
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
63 </template> |
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
64 <script> |
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
65 Polymer({ |
193 | 66 is: 'output-slider', |
67 properties: { | |
68 max: { notify: true }, | |
69 min: { notify: true }, | |
70 step: { notify: true } | |
71 }, | |
187
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
72 }); |
fc5fdcc3ed4a
board control ui: output-rgb, fix ajax protocol, display output uris
drewp@bigasterisk.com
parents:
173
diff
changeset
|
73 </script> |
193 | 74 </dom-module> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
75 |
193 | 76 <!-- |
77 TODO(polyup): Inheriting from other custom elements is not yet supported. | |
78 See: https://www.polymer-project.org/1.0/docs/migration.html#inheritance | |
79 --> | |
80 <dom-module id="output-fixed-text"> | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
81 <template> |
193 | 82 <output-sender subj="{{subj}}" pred="{{pred}}" value="{{value}}"></output-sender> |
83 <textarea rows="{{rows}}" cols="{{cols}}" value="{{value::input}}"></textarea> | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
84 </template> |
193 | 85 <script> |
86 Polymer({ | |
87 is: 'output-fixed-text', | |
88 properties: { | |
89 cols: { notify: true }, | |
90 rows: { notify: true } | |
91 }, | |
92 }); | |
93 </script> | |
94 </dom-module> | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
95 |
193 | 96 <dom-module id="output-switch"> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
97 <template> |
193 | 98 <output-sender subj="{{subj}}" pred="{{pred}}" value="{{value}}"></output-sender> |
99 <input type="checkbox" checked="{{check::change}}"> <span>{{value}}</span> | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
100 </template> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
101 <script> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
102 Polymer({ |
193 | 103 is: 'output-switch', |
104 properties: { | |
105 check: { | |
106 type: Boolean, | |
107 value: false, | |
108 observer: 'checkChanged' | |
109 }, | |
110 value: { notify: true } | |
111 }, | |
112 checkChanged: function () { | |
113 this.value = this.check ? 'high' : 'low'; | |
114 }, | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
115 }); |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
116 </script> |
193 | 117 </dom-module> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
118 |
193 | 119 <dom-module id="output-widget-any"> |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
120 <template></template> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
121 <script> |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
122 Polymer({ |
193 | 123 is: 'output-widget-any', |
124 properties: { | |
125 desc: { type: Object, notify: true } | |
126 }, | |
127 ready: function () { | |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
128 var elem = document.createElement(this.desc.element); |
193 | 129 this.appendChild(elem); |
170
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
130 for (var k of Object.keys(this.desc)) { |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
131 elem.setAttribute(k, this.desc[k]); |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
132 } |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
133 } |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
134 }); |
376599552a4c
polymer board debug page with working output widgets
drewp@bigasterisk.com
parents:
diff
changeset
|
135 </script> |
193 | 136 </dom-module> |