Mercurial > templog
comparison web/views/set.tpl @ 189:101c66da848d
watcher script
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 09 Feb 2014 11:41:13 +0800 |
parents | ae5efca89001 |
children | 8318d50d766d |
comparison
equal
deleted
inserted
replaced
188:ae5efca89001 | 189:101c66da848d |
---|---|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | 2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
3 <head> | 3 <head> |
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
5 <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=8,minimum-scale=0.1"> | 5 <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,minimum-scale=1"> |
6 <script src="jquery-2.1.0.min.js"></script> | 6 <script src="jquery-2.1.0.min.js"></script> |
7 <script src="jquery.mobile.custom.min.js"></script> | 7 <script src="jquery.mobile.custom.min.js"></script> |
8 <script> | 8 <script> |
9 %include riot.min.js | 9 %include riot.min.js |
10 </script> | 10 </script> |
15 -moz-user-select: none; // mozilla browsers | 15 -moz-user-select: none; // mozilla browsers |
16 -khtml-user-select: none; // webkit (konqueror) browsers | 16 -khtml-user-select: none; // webkit (konqueror) browsers |
17 } | 17 } |
18 | 18 |
19 body { | 19 body { |
20 font-family: "sans-serif"; | 20 font-family: sans-serif; |
21 } | 21 } |
22 | 22 |
23 input { | 23 input { |
24 border: 2px solid transparent; | 24 border: 2px solid transparent; |
25 border-radius: 4px; | 25 border-radius: 4px; |
26 background-color: white; | 26 background-color: white; |
27 border-color: black; | 27 border-color: black; |
28 padding: 0; | 28 padding: 0; |
29 font-size: 80%; | 29 font-size: 30pt; |
30 height: 34pt; | |
30 } | 31 } |
31 | 32 |
32 input[type="button"] { | 33 input[type="button"] { |
33 width: 4em; | 34 width: 34pt; |
34 height: 4em; | 35 margin-left: 4pt; |
35 margin-left: 0.5em; | 36 -webkit-appearance: none; |
37 -moz-appearance: none; | |
38 background:#fff; | |
39 vertical-align: center; | |
36 } | 40 } |
37 | 41 |
38 input[type="submit"] { | 42 input[type="submit"] { |
39 width: 10em; | |
40 height: 4em; | |
41 margin-top: 1em; | 43 margin-top: 1em; |
42 align: center; | 44 align: center; |
45 width: 10em; | |
43 } | 46 } |
44 | 47 |
45 input[type="text"], input[type="number"] { | 48 input[type="text"], input[type="number"] { |
46 height: 4em; | |
47 text-align: center; | 49 text-align: center; |
50 width: 4em; | |
48 } | 51 } |
49 | 52 |
50 #savebox { | 53 #savebox { |
51 align: center; | 54 vertical-align: center; |
52 width: 100%; | 55 width: 100%; |
53 } | 56 } |
54 | 57 |
55 .onbutton { | 58 input[type="button"].onbutton { |
56 background-color: #cdf; | 59 background: #ccc; |
60 } | |
61 | |
62 input[type="button"].yesno { | |
63 width: 2.5em; | |
64 } | |
65 | |
66 input[type="button"]#savebutton { | |
67 width: 5em; | |
57 } | 68 } |
58 | 69 |
59 .modified { | 70 .modified { |
60 color: #d00; | 71 color: #d00; |
61 font-weight: bold; | 72 font-weight: bold; |
62 } | 73 } |
63 | 74 |
64 .existing { | 75 .existing { |
65 margin-top: 1em; | 76 margin-top: 10pt; |
66 font-size: 70%; | |
67 } | 77 } |
68 | 78 |
69 </style> | 79 </style> |
70 <title>Set templog</title> | 80 <title>Set templog</title> |
71 </head> | 81 </head> |
83 | 93 |
84 <script type="html/yesno_button"> | 94 <script type="html/yesno_button"> |
85 <div id="{id}"> | 95 <div id="{id}"> |
86 <span class="existing">{title} <span id="oldvalue">{oldvaluetext}</span></span> | 96 <span class="existing">{title} <span id="oldvalue">{oldvaluetext}</span></span> |
87 <br/> | 97 <br/> |
88 <input type="button" class="button_no" value="No"/> | 98 <input type="button" class="button_no yesno" value="No"/> |
89 <input type="button" class="button_yes" value="Yes"/> | 99 <input type="button" class="button_yes yesno" value="Yes"/> |
90 </div> | 100 </div> |
91 </script> | 101 </script> |
92 | 102 |
93 <script> | 103 <script> |
94 | 104 |
155 | 165 |
156 (function() { 'use strict'; | 166 (function() { 'use strict'; |
157 | 167 |
158 var params = {{!inline_data}}; | 168 var params = {{!inline_data}}; |
159 var csrf_blob = "{{!csrf_blob}}"; | 169 var csrf_blob = "{{!csrf_blob}}"; |
170 var allowed = {{allowed}}; | |
160 window.setter = new Setter(params, csrf_blob); | 171 window.setter = new Setter(params, csrf_blob); |
161 | 172 |
162 var number_template = $("[type='html/num_input']").html(); | 173 var number_template = $("[type='html/num_input']").html(); |
163 var button_template = $("[type='html/yesno_button']").html(); | 174 var button_template = $("[type='html/yesno_button']").html(); |
164 | 175 |
203 | 214 |
204 root.empty() && $.each(setter.params, function (idx, p) { | 215 root.empty() && $.each(setter.params, function (idx, p) { |
205 add(p); | 216 add(p); |
206 }) | 217 }) |
207 | 218 |
219 if (!allowed) { | |
220 $("#savebutton").attr("disabled", true); | |
221 $('#status').text("No cert") | |
222 } | |
223 | |
208 $("#savebutton").click(function() { | 224 $("#savebutton").click(function() { |
209 setter.save(); | 225 setter.save(); |
210 }) | 226 }) |
211 | |
212 var gofn = function() { | |
213 var r = '#'; | |
214 r += (5+Math.floor(Math.random() * 5)); | |
215 r += (5+Math.floor(Math.random() * 5)); | |
216 r += (5+Math.floor(Math.random() * 5)); | |
217 document.body.style.background = r; | |
218 this.value = r; | |
219 } | |
220 //$("#go").addEventListener("touchstart", gofn, false) | |
221 //$("#go").addEventListener("click", gofn, false) | |
222 $("#go").on("vmousedown", gofn); | |
223 } | 227 } |
224 | 228 |
225 function set_text_state(el, param) | 229 function set_text_state(el, param) |
226 { | 230 { |
227 var input = $(".input", el); | 231 var input = $(".input", el); |
289 | 293 |
290 | 294 |
291 </script> | 295 </script> |
292 | 296 |
293 <body> | 297 <body> |
294 <input type="button" id="go" value="go"/> | |
295 | |
296 | 298 |
297 <section id="paramlist"> | 299 <section id="paramlist"> |
298 </section> | 300 </section> |
299 | 301 |
300 <div id="savebox"> | 302 <span id="savebox"> |
301 <input type="button" id="savebutton" value="Save"/> | 303 <input type="button" id="savebutton" value="Save"/> |
302 | 304 <span id="status"></span> |
303 <div id="status"> | 305 </span> |
304 </div> | |
305 </div> | |
306 | 306 |
307 | 307 |
308 </body> | 308 </body> |
309 | 309 |
310 </html> | 310 </html> |