Commit ecd90514 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web_renderjs_ui: use css for checkbox when it's not editable

parent 61b7c392
...@@ -110,12 +110,11 @@ ...@@ -110,12 +110,11 @@
<head>\n <head>\n
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n <meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n
<meta name="viewport" content="width=device-width, user-scalable=no" />\n <meta name="viewport" content="width=device-width, user-scalable=no" />\n
<title>ERP5 Stringfield</title>\n <title>ERP5 CheckBoxField</title>\n
\n \n
<!-- renderjs -->\n <!-- renderjs -->\n
<script src="rsvp.js" type="text/javascript"></script>\n <script src="rsvp.js" type="text/javascript"></script>\n
<script src="renderjs.js" type="text/javascript"></script>\n <script src="renderjs.js" type="text/javascript"></script>\n
<script src="gadget_global.js" type="text/javascript"></script>\n
<!-- custom script -->\n <!-- custom script -->\n
<script src="gadget_erp5_field_checkbox.js" type="text/javascript"></script>\n <script src="gadget_erp5_field_checkbox.js" type="text/javascript"></script>\n
\n \n
...@@ -123,7 +122,7 @@ ...@@ -123,7 +122,7 @@
\n \n
</head>\n </head>\n
<body>\n <body>\n
<input type="checkbox" class="checkboxradio"/>\n <input type="checkbox" class="ui-btn"/>\n
</body>\n </body>\n
</html> </html>
...@@ -248,7 +247,7 @@ ...@@ -248,7 +247,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>xiaowu</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -262,7 +261,7 @@ ...@@ -262,7 +261,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>940.56153.13336.11758</string> </value> <value> <string>944.6819.59898.35293</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -280,8 +279,8 @@ ...@@ -280,8 +279,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1423479292.73</float> <float>1435814886.24</float>
<string>UTC</string> <string>GMT+2</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -99,9 +99,9 @@ ...@@ -99,9 +99,9 @@
</item> </item>
<item> <item>
<key> <string>text_content</string> </key> <key> <string>text_content</string> </key>
<value> <string>/*global window, rJS, RSVP, loopEventListener */\n <value> <string>/*global window, rJS, RSVP */\n
/*jslint indent: 2, maxerr: 3 */\n /*jslint indent: 2, maxerr: 3 */\n
(function (window, rJS, loopEventListener) {\n (function (window, rJS) {\n
"use strict";\n "use strict";\n
\n \n
rJS(window)\n rJS(window)\n
...@@ -115,10 +115,12 @@ ...@@ -115,10 +115,12 @@
.declareMethod(\'render\', function (options) {\n .declareMethod(\'render\', function (options) {\n
var input = this.element.querySelector(\'input\'),\n var input = this.element.querySelector(\'input\'),\n
field_json = options.field_json || {};\n field_json = options.field_json || {};\n
input.editable = field_json.editable;\n
input.checked = field_json.value || field_json.default;\n input.checked = field_json.value || field_json.default;\n
input.setAttribute(\'name\', field_json.key);\n input.setAttribute(\'name\', field_json.key);\n
input.setAttribute(\'title\', field_json.title);\n input.setAttribute(\'title\', field_json.title);\n
if (field_json.editable === 0) {\n
input.setAttribute("class", "ui-btn ui-state-readonly");\n
}\n
})\n })\n
\n \n
.declareMethod(\'getContent\', function () {\n .declareMethod(\'getContent\', function () {\n
...@@ -126,17 +128,8 @@ ...@@ -126,17 +128,8 @@
result = {};\n result = {};\n
result[input.getAttribute(\'name\')] = (input.checked ? 1 : 0);\n result[input.getAttribute(\'name\')] = (input.checked ? 1 : 0);\n
return result;\n return result;\n
})\n
.declareService(function () {\n
var gadget = this,\n
input = gadget.element.querySelector(\'input\');\n
if (input.editable === 0) {\n
return loopEventListener(input, "click", false, function () {\n
return;\n
});\n
}\n
});\n });\n
}(window, rJS, loopEventListener));</string> </value> }(window, rJS));</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -257,7 +250,7 @@ ...@@ -257,7 +250,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>xiaowu</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -271,7 +264,7 @@ ...@@ -271,7 +264,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>940.57489.27228.34747</string> </value> <value> <string>944.6824.36715.55227</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -289,8 +282,8 @@ ...@@ -289,8 +282,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1423558237.8</float> <float>1435815104.42</float>
<string>UTC</string> <string>GMT+2</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment