Commit 2c3b23b1 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_web_renderjs_ui: Use domsugar instead of document.createElement

parent 157e2c07
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<!-- renderjs --> <!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script> <script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script> <script src="renderjs.js" type="text/javascript"></script>
<script src="domsugar.js" type="text/javascript"></script>
<!-- custom script --> <!-- custom script -->
<script src="gadget_erp5_form.js" type="text/javascript"></script> <script src="gadget_erp5_form.js" type="text/javascript"></script>
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>969.41882.58371.33382</string> </value> <value> <string>987.52327.33749.63539</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1536679144.45</float> <float>1605646543.35</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*jslint nomen: true, indent: 2, maxerr: 3 */ /*jslint nomen: true, indent: 2, maxerr: 3 */
/*global window, document, rJS, RSVP*/ /*global window, document, rJS, RSVP, domsugar*/
/** Form is one of a complicated gadget! /** Form is one of a complicated gadget!
* *
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* changed in FormBox gadget which renders form as a subgadget * changed in FormBox gadget which renders form as a subgadget
**/ **/
(function (window, document, rJS, RSVP) { (function (window, document, rJS, RSVP, domsugar) {
"use strict"; "use strict";
/** /**
...@@ -234,19 +234,19 @@ ...@@ -234,19 +234,19 @@
} }
if (form_definition.hasOwnProperty("edit_form_href")) { if (form_definition.hasOwnProperty("edit_form_href")) {
field_href = document.createElement("a"); field_href = domsugar("a");
field_href.href = form_definition.edit_form_href; field_href.href = form_definition.edit_form_href;
field_href.title = "Edit this form"; field_href.title = "Edit this form";
field_href.appendChild(document.createElement("img")); field_href.appendChild(domsugar("img"));
field_href.firstElementChild.src = form_definition.edit_form_icon; field_href.firstElementChild.src = form_definition.edit_form_icon;
form_gadget.element.insertBefore(field_href, dom_element); form_gadget.element.insertBefore(field_href, dom_element);
} }
if (form_definition.hasOwnProperty("edit_form_action_href")) { if (form_definition.hasOwnProperty("edit_form_action_href")) {
field_href = document.createElement("a"); field_href = domsugar("a");
field_href.href = form_definition.edit_form_action_href; field_href.href = form_definition.edit_form_action_href;
field_href.title = "Edit this form's action"; field_href.title = "Edit this form's action";
field_href.appendChild(document.createElement("img")); field_href.appendChild(domsugar("img"));
field_href.firstElementChild.src = form_definition.edit_form_action_icon; field_href.firstElementChild.src = form_definition.edit_form_action_icon;
form_gadget.element.insertBefore(field_href, dom_element); form_gadget.element.insertBefore(field_href, dom_element);
} }
...@@ -328,4 +328,4 @@ ...@@ -328,4 +328,4 @@
}, {mutex: 'changestate'}); }, {mutex: 'changestate'});
}(window, document, rJS, RSVP)); }(window, document, rJS, RSVP, domsugar));
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>987.52017.59742.51780</string> </value> <value> <string>988.2144.42914.58385</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1604672111.49</float> <float>1605646718.06</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -10,8 +10,10 @@ ...@@ -10,8 +10,10 @@
<!-- renderjs --> <!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script> <script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script> <script src="renderjs.js" type="text/javascript"></script>
<script src="domsugar.js" type="text/javascript"></script>
<!-- custom script --> <!-- custom script -->
<script src="gadget_erp5_label_field.js" type="text/javascript"></script> <script src="gadget_erp5_label_field.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<div class="ui-field-contain"> <div class="ui-field-contain">
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>970.11191.7445.40789</string> </value> <value> <string>988.2724.42282.37358</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1536679172.23</float> <float>1605646555.5</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, document, rJS */ /*global window, document, rJS, domsugar */
/*jslint indent: 2, maxerr: 3 */ /*jslint indent: 2, maxerr: 3 */
/** /**
* Label gadget takes care of displaying validation errors and label. * Label gadget takes care of displaying validation errors and label.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* - class "horizontal_align_form_box" will prevent any label to show as well * - class "horizontal_align_form_box" will prevent any label to show as well
* *
*/ */
(function (window, document, rJS) { (function (window, document, rJS, domsugar) {
"use strict"; "use strict";
var SCOPE = 'field'; var SCOPE = 'field';
...@@ -134,28 +134,28 @@ ...@@ -134,28 +134,28 @@
if (field_json) { if (field_json) {
if (field_json.hasOwnProperty('edit_field_href')) { if (field_json.hasOwnProperty('edit_field_href')) {
field_href = document.createElement("a"); field_href = domsugar("a");
field_href.href = field_json.edit_field_href; field_href.href = field_json.edit_field_href;
field_href.title = "Edit this field"; field_href.title = "Edit this field";
field_href.appendChild(document.createElement("img")); field_href.appendChild(domsugar("img"));
field_href.firstElementChild.src = field_json.edit_field_icon; field_href.firstElementChild.src = field_json.edit_field_icon;
this.props.label_element.appendChild(field_href); this.props.label_element.appendChild(field_href);
} }
if (field_json.hasOwnProperty('translate_title_href')) { if (field_json.hasOwnProperty('translate_title_href')) {
field_href = document.createElement("a"); field_href = domsugar("a");
field_href.href = field_json.translate_title_href; field_href.href = field_json.translate_title_href;
field_href.title = "Translate this field title"; field_href.title = "Translate this field title";
field_href.appendChild(document.createElement("img")); field_href.appendChild(domsugar("img"));
field_href.firstElementChild.src = field_json.translate_title_icon; field_href.firstElementChild.src = field_json.translate_title_icon;
this.props.label_element.appendChild(field_href); this.props.label_element.appendChild(field_href);
} }
if (field_json.hasOwnProperty('translate_description_href')) { if (field_json.hasOwnProperty('translate_description_href')) {
field_href = document.createElement("a"); field_href = domsugar("a");
field_href.href = field_json.translate_description_href; field_href.href = field_json.translate_description_href;
field_href.title = "Translate this field description"; field_href.title = "Translate this field description";
field_href.appendChild(document.createElement("img")); field_href.appendChild(domsugar("img"));
field_href.firstElementChild.src = field_json.translate_description_icon; field_href.firstElementChild.src = field_json.translate_description_icon;
this.props.label_element.appendChild(field_href); this.props.label_element.appendChild(field_href);
} }
...@@ -280,4 +280,4 @@ ...@@ -280,4 +280,4 @@
return this.changeState({first_call: true, error_text: error_text}); return this.changeState({first_call: true, error_text: error_text});
}); });
}(window, document, rJS)); }(window, document, rJS, domsugar));
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>987.42313.38411.5666</string> </value> <value> <string>988.2731.33743.17595</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1604090662.46</float> <float>1605646942.89</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -295,19 +295,19 @@ ...@@ -295,19 +295,19 @@
selector.textContent = "\u00A0" + translated_title_list[0]; selector.textContent = "\u00A0" + translated_title_list[0];
selector.className = "ui-content-title ui-body-c ui-icon ui-icon-custom" + icon; selector.className = "ui-content-title ui-body-c ui-icon ui-icon-custom" + icon;
if (form_definition.hasOwnProperty("edit_form_href")) { if (form_definition.hasOwnProperty("edit_form_href")) {
field_href = document.createElement("a"); field_href = domsugar("a");
field_href.href = form_definition.edit_form_href; field_href.href = form_definition.edit_form_href;
field_href.title = "Edit this form"; field_href.title = "Edit this form";
field_href.appendChild(document.createElement("img")); field_href.appendChild(domsugar("img"));
field_href.firstElementChild.src = form_definition.edit_form_icon; field_href.firstElementChild.src = form_definition.edit_form_icon;
selector.appendChild(field_href); selector.appendChild(field_href);
} }
if (form_definition.hasOwnProperty("edit_form_action_href")) { if (form_definition.hasOwnProperty("edit_form_action_href")) {
field_href = document.createElement("a"); field_href = domsugar("a");
field_href.href = form_definition.edit_form_action_href; field_href.href = form_definition.edit_form_action_href;
field_href.title = "Edit this form's action"; field_href.title = "Edit this form's action";
field_href.appendChild(document.createElement("img")); field_href.appendChild(domsugar("img"));
field_href.firstElementChild.src = form_definition.edit_form_action_icon; field_href.firstElementChild.src = form_definition.edit_form_action_icon;
selector.appendChild(field_href); selector.appendChild(field_href);
} }
......
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>987.42388.43014.21896</string> </value> <value> <string>987.52327.33749.63539</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1604095960.55</float> <float>1605641027.16</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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