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 @@
<head>\n
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />\n
<meta name="viewport" content="width=device-width, user-scalable=no" />\n
<title>ERP5 Stringfield</title>\n
<title>ERP5 CheckBoxField</title>\n
\n
<!-- renderjs -->\n
<script src="rsvp.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
<script src="gadget_erp5_field_checkbox.js" type="text/javascript"></script>\n
\n
......@@ -123,7 +122,7 @@
\n
</head>\n
<body>\n
<input type="checkbox" class="checkboxradio"/>\n
<input type="checkbox" class="ui-btn"/>\n
</body>\n
</html>
......@@ -248,7 +247,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>xiaowu</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -262,7 +261,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.56153.13336.11758</string> </value>
<value> <string>944.6819.59898.35293</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -280,8 +279,8 @@
</tuple>
<state>
<tuple>
<float>1423479292.73</float>
<string>UTC</string>
<float>1435814886.24</float>
<string>GMT+2</string>
</tuple>
</state>
</object>
......
......@@ -99,9 +99,9 @@
</item>
<item>
<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
(function (window, rJS, loopEventListener) {\n
(function (window, rJS) {\n
"use strict";\n
\n
rJS(window)\n
......@@ -115,10 +115,12 @@
.declareMethod(\'render\', function (options) {\n
var input = this.element.querySelector(\'input\'),\n
field_json = options.field_json || {};\n
input.editable = field_json.editable;\n
input.checked = field_json.value || field_json.default;\n
input.setAttribute(\'name\', field_json.key);\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
.declareMethod(\'getContent\', function () {\n
......@@ -126,17 +128,8 @@
result = {};\n
result[input.getAttribute(\'name\')] = (input.checked ? 1 : 0);\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
}(window, rJS, loopEventListener));</string> </value>
}(window, rJS));</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -257,7 +250,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>xiaowu</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -271,7 +264,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.57489.27228.34747</string> </value>
<value> <string>944.6824.36715.55227</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -289,8 +282,8 @@
</tuple>
<state>
<tuple>
<float>1423558237.8</float>
<string>UTC</string>
<float>1435815104.42</float>
<string>GMT+2</string>
</tuple>
</state>
</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