Commit f9954f7f authored by Sven Franck's avatar Sven Franck Committed by Xiaowu Zhang

erp5_web_renderjs_ui: add translations to all gadgets using text

- make sure only strings are passed to and returned from translation gadget
- make sure to wrap in correct temporary elements (table rows in table, options in select, rest in div)
- make sure forms are present when declareService is called
parent e8f22007
...@@ -130,6 +130,7 @@ ...@@ -130,6 +130,7 @@
})\n })\n
\n \n
.declareAcquiredMethod("aq_put", "jio_put")\n .declareAcquiredMethod("aq_put", "jio_put")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
\n \n
.allowPublicAcquisition("notifyInvalid", function (param_list, scope) {\n .allowPublicAcquisition("notifyInvalid", function (param_list, scope) {\n
return this.getDeclaredGadget(scope)\n return this.getDeclaredGadget(scope)\n
...@@ -208,6 +209,7 @@ ...@@ -208,6 +209,7 @@
// field_element.setAttribute(\'data-role\', \'fieldcontain\');\n // field_element.setAttribute(\'data-role\', \'fieldcontain\');\n
label_element.setAttribute(\'for\', renderered_field.key);\n label_element.setAttribute(\'for\', renderered_field.key);\n
label_element.textContent = renderered_field.title;\n label_element.textContent = renderered_field.title;\n
label_element.setAttribute(\'data-i18n\', renderered_field.title);\n
// error_element.setAttribute(\'class\', \'ui-state-error ui-corner-all\');\n // error_element.setAttribute(\'class\', \'ui-state-error ui-corner-all\');\n
label_element.appendChild(error_element);\n label_element.appendChild(error_element);\n
if (group[0] !== "bottom") {\n if (group[0] !== "bottom") {\n
...@@ -269,12 +271,17 @@ ...@@ -269,12 +271,17 @@
\n \n
return queue\n return queue\n
.push(function () {\n .push(function () {\n
var temp = document.createElement("div");\n
temp.appendChild(parent_element);\n
return form_gadget.translateHtml(temp.innerHTML);\n
})\n
.push(function (my_translated_html) {\n
var dom_element = form_gadget.props.element\n var dom_element = form_gadget.props.element\n
.querySelector(".field_container");\n .querySelector(".field_container");\n
while (dom_element.firstChild) {\n while (dom_element.firstChild) {\n
dom_element.removeChild(dom_element.firstChild);\n dom_element.removeChild(dom_element.firstChild);\n
}\n }\n
dom_element.appendChild(parent_element);\n dom_element.innerHTML = my_translated_html;\n
// return $(parent_element).trigger("create");\n // return $(parent_element).trigger("create");\n
\n \n
});\n });\n
...@@ -465,7 +472,7 @@ ...@@ -465,7 +472,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>romain</string> </value> <value> <string>super_sven</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -479,7 +486,7 @@ ...@@ -479,7 +486,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>937.64346.57999.39918</string> </value> <value> <string>939.62597.55939.38724</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -497,7 +504,7 @@ ...@@ -497,7 +504,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1412339249.91</float> <float>1419932704.16</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -129,13 +129,13 @@ ...@@ -129,13 +129,13 @@
<div class="ui-table-header ui-header ui-bar-c ui-corner-all">\n <div class="ui-table-header ui-header ui-bar-c ui-corner-all">\n
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-left">\n <div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-left">\n
<div class="ui-controlgroup-controls">\n <div class="ui-controlgroup-controls">\n
<a data-i18n="header-hide" class="ui-responsive ui-btn ui-btn-icon-left ui-icon-eye ui-first-child ui-override-theme ui-disabled" href="#">Hide Rows</a>\n <a data-i18n="hide" class="ui-responsive ui-btn ui-btn-icon-left ui-icon-eye ui-first-child ui-override-theme ui-disabled" href="#">Hide Rows</a>\n
</div>\n </div>\n
</div>\n </div>\n
<h1 data-i18n="header-selected" class="ui-title ui-override-theme">0 items selected</h1>\n <h1 data-i18n="selected" class="ui-title ui-override-theme">0 items selected</h1>\n
<div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-right">\n <div class="ui-controlgroup ui-controlgroup-horizontal ui-btn-right">\n
<div class="ui-controlgroup-controls">\n <div class="ui-controlgroup-controls">\n
<a data-i18n="header-sort" class="ui-responsive ui-btn ui-btn-icon-left ui-icon-sort-amount-desc ui-last-child ui-override-theme ui-disabled" href="#">Sort</a>\n <a data-i18n="sort" class="ui-responsive ui-btn ui-btn-icon-left ui-icon-sort-amount-desc ui-last-child ui-override-theme ui-disabled" href="#">Sort</a>\n
</div>\n </div>\n
</div>\n </div>\n
</div>\n </div>\n
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>939.43978.9403.31744</string> </value> <value> <string>939.51034.42464.64273</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -301,7 +301,7 @@ ...@@ -301,7 +301,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1419238718.84</float> <float>1419418783.77</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
// acquired method\n // acquired method\n
//////////////////////////////////////////////\n //////////////////////////////////////////////\n
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")\n .declareAcquiredMethod("jio_allDocs", "jio_allDocs")\n
.declareAcquiredMethod("translateElementList", "translateElementList")\n .declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n .declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("pleasePublishMyState", "pleasePublishMyState")\n .declareAcquiredMethod("pleasePublishMyState", "pleasePublishMyState")\n
//////////////////////////////////////////////\n //////////////////////////////////////////////\n
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
for (i = 0; i < field_json.column_list.length; i += 1) {\n for (i = 0; i < field_json.column_list.length; i += 1) {\n
th = document.createElement("th");\n th = document.createElement("th");\n
th.textContent = field_json.column_list[i][1];\n th.textContent = field_json.column_list[i][1];\n
th.setAttribute("data-i18n", "title-" + field_json.column_list[i][1].replace(" ", "-"));\n th.setAttribute("data-i18n", field_json.column_list[i][1]);\n
tr.appendChild(th);\n tr.appendChild(th);\n
}\n }\n
thead.appendChild(tr);\n thead.appendChild(tr);\n
...@@ -281,25 +281,25 @@ ...@@ -281,25 +281,25 @@
\n \n
paging_prev.className = "ui-btn ui-icon-carat-l ui-btn-icon-left responsive ui-first-child";\n paging_prev.className = "ui-btn ui-icon-carat-l ui-btn-icon-left responsive ui-first-child";\n
paging_prev.textContent = "Previous";\n paging_prev.textContent = "Previous";\n
paging_prev.setAttribute("data-i18n", "subheader-previous");\n paging_prev.setAttribute("data-i18n", "previous");\n
paging_prev.href = url_list[0];\n paging_prev.href = url_list[0];\n
paging_info.className = "ui-btn ui-disabled";\n paging_info.className = "ui-btn ui-disabled";\n
if ((begin_from === 0) && (counter === 0)) {\n if ((begin_from === 0) && (counter === 0)) {\n
paging_info.textContent = "No records";\n paging_info.textContent = "No records";\n
paging_info.setAttribute("data-i18n", "listbox-no-records");\n paging_info.setAttribute("data-i18n", "No Records");\n
} else if ((dataset.data.rows.length <= lines) && (begin_from === 0)) {\n } else if ((dataset.data.rows.length <= lines) && (begin_from === 0)) {\n
paging_info.setAttribute("data-i18n", "[last]listbox-records");\n paging_info.setAttribute("data-i18n", "[last]Record(s)");\n
paging_info.appendChild(document.createTextNode(counter));\n paging_info.appendChild(document.createTextNode(counter));\n
paging_info.appendChild(document.createTextNode("Record(s)"));\n paging_info.appendChild(document.createTextNode("Record(s)"));\n
} else {\n } else {\n
paging_info.setAttribute("data-i18n", "[node]listbox-records");\n paging_info.setAttribute("data-i18n", "[node]Record(s)");\n
paging_info.appendChild(document.createTextNode("Records "));\n paging_info.appendChild(document.createTextNode("Records "));\n
paging_info.appendChild(document.createTextNode((((begin_from + lines) / lines - 1) * lines + 1) + " - " + (((begin_from + lines) / lines - 1) * lines + counter)));\n paging_info.appendChild(document.createTextNode((((begin_from + lines) / lines - 1) * lines + 1) + " - " + (((begin_from + lines) / lines - 1) * lines + counter)));\n
}\n }\n
// paging_info.textContent = "Page " + ((begin_from + lines) / lines);\n // paging_info.textContent = "Page " + ((begin_from + lines) / lines);\n
paging_next.className = "ui-btn ui-icon-carat-r ui-btn-icon-right responsive ui-last-child";\n paging_next.className = "ui-btn ui-icon-carat-r ui-btn-icon-right responsive ui-last-child";\n
paging_next.textContent = "Next";\n paging_next.textContent = "Next";\n
paging_next.setAttribute("data-i18n", "subheader-next");\n paging_next.setAttribute("data-i18n", "next");\n
paging_next.href = url_list[1];\n paging_next.href = url_list[1];\n
\n \n
if (begin_from === 0) {\n if (begin_from === 0) {\n
...@@ -324,10 +324,12 @@ ...@@ -324,10 +324,12 @@
}\n }\n
\n \n
table.appendChild(fragment);\n table.appendChild(fragment);\n
\n \n
return gadget.translateElementList(gadget.props.element);\n // XXX: DOM touches\n
return gadget.translateHtml(gadget.props.element.innerHTML);\n
})\n })\n
.push(function () {\n .push(function (my_translated_html) {\n
gadget.props.element.innerHTML = my_translated_html;\n
return gadget;\n return gadget;\n
});\n });\n
});\n });\n
...@@ -469,7 +471,7 @@ ...@@ -469,7 +471,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>939.51159.64219.13858</string> </value> <value> <string>939.51316.12701.36232</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -487,7 +489,7 @@ ...@@ -487,7 +489,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1419255611.6</float> <float>1419419239.32</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -120,11 +120,11 @@ ...@@ -120,11 +120,11 @@
<script src="gadget_erp5_field_list.js" type="text/javascript"></script>\n <script src="gadget_erp5_field_list.js" type="text/javascript"></script>\n
\n \n
<script id="option-template" type="text/x-handlebars-template">\n <script id="option-template" type="text/x-handlebars-template">\n
<option value="{{value}}">{{text}}</option>\n <option value="{{value}}" data-i18n="{{text}}">{{text}}</option>\n
</script>\n </script>\n
\n \n
<script id="selected-option-template" type="text/x-handlebars-template">\n <script id="selected-option-template" type="text/x-handlebars-template">\n
<option selected="selected" value="{{value}}">{{text}}</option>\n <option selected="selected" data-i18n="{{text}}" value="{{value}}">{{text}}</option>\n
</script>\n </script>\n
\n \n
</head>\n </head>\n
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>sven</string> </value> <value> <string>super_sven</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>937.51428.60613.12390</string> </value> <value> <string>939.43978.9403.31744</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -286,7 +286,7 @@ ...@@ -286,7 +286,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1411576752.72</float> <float>1419418540.22</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -127,12 +127,21 @@ ...@@ -127,12 +127,21 @@
g.element = element;\n g.element = element;\n
});\n });\n
})\n })\n
\n
//////////////////////////////////////////////\n
// acquired method\n
//////////////////////////////////////////////\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
\n
.declareMethod(\'render\', function (options) {\n .declareMethod(\'render\', function (options) {\n
var select = this.element.querySelector(\'select\'),\n var i,\n
i,\n
template,\n template,\n
gadget = this,\n
select = this.element.querySelector(\'select\'),\n
field_json = options.field_json,\n field_json = options.field_json,\n
tmp = \'\';\n tmp = "",\n
wrap = document.createElement("select");\n
\n
select.setAttribute(\'name\', field_json.key);\n select.setAttribute(\'name\', field_json.key);\n
for (i = 0; i < field_json.items.length; i += 1) {\n for (i = 0; i < field_json.items.length; i += 1) {\n
if (field_json.items[i][1] === field_json.default) {\n if (field_json.items[i][1] === field_json.default) {\n
...@@ -145,7 +154,31 @@ ...@@ -145,7 +154,31 @@
text: field_json.items[i][0]\n text: field_json.items[i][0]\n
});\n });\n
}\n }\n
select.innerHTML += tmp;\n \n
// need a <select> for transport\n
wrap.innerHTML = tmp;\n
\n
return new RSVP.Queue()\n
.push(function () {\n
return gadget.translateHtml(wrap.outerHTML);\n
})\n
.push(function (my_translated_html) {\n
// XXX: no fan...\n
var option_list,\n
i,\n
i_len,\n
fragment = document.createDocumentFragment(),\n
div = document.createElement("div");\n
\n
div.innerHTML = my_translated_html;\n
option_list = div.querySelectorAll("option");\n
for (i = 0, i_len = option_list.length; i < i_len; i += 1) {\n
fragment.appendChild(option_list[i]);\n
}\n
\n
select.appendChild(fragment);\n
// XXX: no fan end\n
\n
if (field_json.required === 1) {\n if (field_json.required === 1) {\n
select.setAttribute(\'required\', \'required\');\n select.setAttribute(\'required\', \'required\');\n
}\n }\n
...@@ -153,8 +186,9 @@ ...@@ -153,8 +186,9 @@
select.setAttribute(\'readonly\', \'readonly\');\n select.setAttribute(\'readonly\', \'readonly\');\n
select.setAttribute(\'data-wrapper-class\', \'ui-state-readonly\');\n select.setAttribute(\'data-wrapper-class\', \'ui-state-readonly\');\n
// select.setAttribute(\'disabled\', \'disabled\');\n // select.setAttribute(\'disabled\', \'disabled\');\n
\n \n
}\n }\n
});\n
})\n })\n
\n \n
.declareMethod(\'getContent\', function () {\n .declareMethod(\'getContent\', function () {\n
...@@ -287,7 +321,7 @@ ...@@ -287,7 +321,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>romain</string> </value> <value> <string>super_sven</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -301,7 +335,7 @@ ...@@ -301,7 +335,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>937.59950.62249.34679</string> </value> <value> <string>939.61577.21369.11400</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -319,7 +353,7 @@ ...@@ -319,7 +353,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1412243487.09</float> <float>1419871313.56</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
// Acquired methods\n // Acquired methods\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_get", "jio_get")\n .declareAcquiredMethod("jio_get", "jio_get")\n
.declareAcquiredMethod("translateElementList", "translateElementList")\n .declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n .declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n .declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
\n \n
...@@ -195,9 +195,14 @@ ...@@ -195,9 +195,14 @@
breadcrumb_url: all_result[1]\n breadcrumb_url: all_result[1]\n
});\n });\n
})\n })\n
// XXX: DOM touches\n
.push(function () {\n .push(function () {\n
return gadget.translateElementList(gadget.props.element);\n return gadget.translateHtml(gadget.props.element.innerHTML);\n
})\n
.push(function (my_translated_html) {\n
gadget.props.element.innerHTML = my_translated_html;\n
});\n });\n
\n
\n \n
});\n });\n
\n \n
...@@ -338,7 +343,7 @@ ...@@ -338,7 +343,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>939.52883.6676.56371</string> </value> <value> <string>939.52883.40109.10154</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -356,7 +361,7 @@ ...@@ -356,7 +361,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1419349656.69</float> <float>1419417919.94</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
.declareAcquiredMethod("jio_get", "jio_get")\n .declareAcquiredMethod("jio_get", "jio_get")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n .declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n .declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("translateElementList", "translateElementList")\n .declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n .declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
\n \n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
...@@ -205,8 +205,12 @@ ...@@ -205,8 +205,12 @@
\n \n
return gadget.renderPageHeader(header_options);\n return gadget.renderPageHeader(header_options);\n
})\n })\n
// XXX: DOM touches\n
.push(function () {\n .push(function () {\n
return gadget.translateElementList(gadget.props.element);\n return gadget.translateHtml(gadget.props.element.innerHTML);\n
})\n
.push(function (my_translated_html) {\n
gadget.props.element.innerHTML = my_translated_html;\n
});\n });\n
\n \n
});\n });\n
...@@ -346,7 +350,7 @@ ...@@ -346,7 +350,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>939.43978.9403.31744</string> </value> <value> <string>939.52887.29595.20992</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -364,7 +368,7 @@ ...@@ -364,7 +368,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1419349887.08</float> <float>1419417866.54</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n .declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n .declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n .declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("translateElementList", "translateElementList")\n .declareAcquiredMethod("translateHtml", "translateHtmlt")\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n .declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
.declareAcquiredMethod("notifySubmitting", "notifySubmitting")\n .declareAcquiredMethod("notifySubmitting", "notifySubmitting")\n
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")\n .declareAcquiredMethod("notifySubmitted", "notifySubmitted")\n
...@@ -209,9 +209,14 @@ ...@@ -209,9 +209,14 @@
submit_action: true\n submit_action: true\n
});\n });\n
})\n })\n
// XXX: DOM touches\n
.push(function () {\n .push(function () {\n
return form_gadget.translateElementList(form_gadget.props.element);\n return form_gadget.translateHtml(form_gadget.props.element.innerHTML);\n
})\n
.push(function (my_translated_html) {\n
form_gadget.props.element.innerHTML = my_translated_html;\n
});\n });\n
\n
})\n })\n
\n \n
\n \n
...@@ -412,7 +417,7 @@ ...@@ -412,7 +417,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>939.52858.19121.54596</string> </value> <value> <string>939.52858.22584.102</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -430,7 +435,7 @@ ...@@ -430,7 +435,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1419348140.66</float> <float>1419417804.84</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
<!-- XXX action, method, fieldset -->\n <!-- XXX action, method, fieldset -->\n
<!-- XXX needs a theme -->\n <!-- XXX needs a theme -->\n
<form class="save_form ui-body-c" novalidate>\n <form class="save_form ui-body-c" novalidate>\n
<button data-i18n="header-save" type="submit" class="ui-btn ui-btn-b ui-btn-inline\n <button data-i18n="save" type="submit" class="ui-btn ui-btn-b ui-btn-inline\n
ui-icon-edit ui-btn-icon-right ui-screen-hidden">Save</button>\n ui-icon-edit ui-btn-icon-right ui-screen-hidden">Save</button>\n
\n \n
<div data-gadget-url="gadget_erp5_form.html"\n <div data-gadget-url="gadget_erp5_form.html"\n
...@@ -278,7 +278,7 @@ ...@@ -278,7 +278,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>939.43978.9403.31744</string> </value> <value> <string>939.51440.6706.38775</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -296,7 +296,7 @@ ...@@ -296,7 +296,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1419263046.11</float> <float>1419417591.82</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -129,6 +129,7 @@ ...@@ -129,6 +129,7 @@
})\n })\n
\n \n
.declareAcquiredMethod("aq_put", "jio_put")\n .declareAcquiredMethod("aq_put", "jio_put")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n .declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n .declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n .declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
...@@ -188,8 +189,14 @@ ...@@ -188,8 +189,14 @@
breadcrumb_url: all_result[4],\n breadcrumb_url: all_result[4],\n
save_action: true\n save_action: true\n
});\n });\n
})\n
// XXX: DOM touches\n
.push(function () {\n
return form_gadget.translateHtml(form_gadget.props.element.innerHTML);\n
})\n
.push(function (my_translated_html) {\n
form_gadget.props.element.innerHTML = my_translated_html;\n
});\n });\n
\n
})\n })\n
\n \n
\n \n
...@@ -351,7 +358,7 @@ ...@@ -351,7 +358,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>romain</string> </value> <value> <string>super_sven</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -365,7 +372,7 @@ ...@@ -365,7 +372,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>938.190.52141.13448</string> </value> <value> <string>939.43978.9403.31744</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -383,7 +390,7 @@ ...@@ -383,7 +390,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1412343933.71</float> <float>1419417712.26</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -125,11 +125,11 @@ ...@@ -125,11 +125,11 @@
<!-- XXX must set theme here! -->\n <!-- XXX must set theme here! -->\n
<script id="table-template" type="text/x-handlebars-template">\n <script id="table-template" type="text/x-handlebars-template">\n
<div data-role="collapsible">\n <div data-role="collapsible">\n
<h3 class="ui-bar-inherit">{{definition_title}}</h3>\n <h3 class="ui-bar-inherit" data-i18n="{{definition_title}}">{{definition_title}}</h3>\n
<ul data-role="listview" data-theme="c" class="document-listview">\n <ul data-role="listview" data-theme="c" class="document-listview">\n
<!--<li data-role="list-divider"><h1>{{definition_title}}</h1></li>-->\n <!--<li data-role="list-divider"><h1 data-i18n="{{definition_title}}">{{definition_title}}</h1></li>-->\n
{{#each documentlist}}\n {{#each documentlist}}\n
<li><a class="ui-body-inherit" href="{{link}}">{{title}}</a></li>\n <li><a class="ui-body-inherit" data-i18n="{{title}}" href="{{link}}">{{title}}</a></li>\n
{{/each}}\n {{/each}}\n
</ul>\n </ul>\n
</div>\n </div>\n
...@@ -262,7 +262,7 @@ ...@@ -262,7 +262,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>sven</string> </value> <value> <string>super_sven</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>938.17159.11576.22732</string> </value> <value> <string>939.43978.9403.31744</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -294,7 +294,7 @@ ...@@ -294,7 +294,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1413363058.89</float> <float>1419417426.65</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -137,6 +137,7 @@ ...@@ -137,6 +137,7 @@
// Acquired methods\n // Acquired methods\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")\n .declareAcquiredMethod("jio_allDocs", "jio_allDocs")\n
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("whoWantToDisplayThis",\n .declareAcquiredMethod("whoWantToDisplayThis",\n
"whoWantToDisplayThis")\n "whoWantToDisplayThis")\n
\n \n
...@@ -224,7 +225,10 @@ ...@@ -224,7 +225,10 @@
\n \n
result_html += \'</div>\';\n result_html += \'</div>\';\n
\n \n
gadget.props.element.querySelector(\'.document_list\').innerHTML = result_html;\n return gadget.translateHtml(result_html);\n
})\n
.push(function (my_translated_html) {\n
gadget.props.element.querySelector(\'.document_list\').innerHTML = my_translated_html;\n
});\n });\n
});\n });\n
}(window, rJS, RSVP, Handlebars)); }(window, rJS, RSVP, Handlebars));
...@@ -350,7 +354,7 @@ ...@@ -350,7 +354,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>sven</string> </value> <value> <string>super_sven</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -364,7 +368,7 @@ ...@@ -364,7 +368,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>938.16182.63738.26641</string> </value> <value> <string>939.43978.9403.31744</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -382,7 +386,7 @@ ...@@ -382,7 +386,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1413301956.28</float> <float>1419417516.48</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
// handle acquisition\n // handle acquisition\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n .declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
.declareAcquiredMethod("translateElementList", "translateElementList")\n .declareAcquiredMethod("translateHtml", "translateHtml")\n
\n \n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// declared methods\n // declared methods\n
...@@ -133,9 +133,13 @@ ...@@ -133,9 +133,13 @@
.declareMethod("render", function () {\n .declareMethod("render", function () {\n
var gadget = this;\n var gadget = this;\n
\n \n
// XXX: Lot of DOM touches\n
return new RSVP.Queue()\n return new RSVP.Queue()\n
.push(function () {\n .push(function () {\n
return gadget.translateElementList(g.props.element);\n return gadget.translateHtml(gadget.props.element.innerHTML);\n
})\n
.push(function (my_translated_html) {\n
gadget.props.element.innerHTML = my_translated_html;\n
});\n });\n
})\n })\n
\n \n
...@@ -296,7 +300,7 @@ ...@@ -296,7 +300,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>939.43978.9403.31744</string> </value> <value> <string>939.54011.36657.61064</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -314,7 +318,7 @@ ...@@ -314,7 +318,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1419349125.71</float> <float>1419435753.44</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
</section>\n </section>\n
<ul data-role="listview" data-theme="c" data-inset="true" class="document-listview">\n <ul data-role="listview" data-theme="c" data-inset="true" class="document-listview">\n
{{#each documentlist}}\n {{#each documentlist}}\n
<li><a data-i18n="{{i18n}}" class="ui-body-inherit" href="{{link}}">{{title}}</a></li>\n <li><a data-i18n="{{title}}" class="ui-body-inherit" href="{{link}}">{{title}}</a></li>\n
{{/each}}\n {{/each}}\n
</ul>\n </ul>\n
</script>\n </script>\n
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>939.51478.33243.40192</string> </value> <value> <string>939.51485.40506.26299</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -294,7 +294,7 @@ ...@@ -294,7 +294,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1419265777.06</float> <float>1419930446.08</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -138,16 +138,17 @@ ...@@ -138,16 +138,17 @@
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
.declareAcquiredMethod("jio_get", "jio_get")\n .declareAcquiredMethod("jio_get", "jio_get")\n
.declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n .declareAcquiredMethod("whoWantToDisplayThisPage", "whoWantToDisplayThisPage")\n
.declareAcquiredMethod("translateElementList", "translateElementList")\n .declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n .declareAcquiredMethod("renderPageHeader", "renderPageHeader")\n
\n \n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
// declared methods\n // declared methods\n
/////////////////////////////////////////////////////////////////\n /////////////////////////////////////////////////////////////////\n
.declareMethod("render", function (options) {\n .declareMethod("render", function (options) {\n
var gadget = this,\n var view_list,\n
matching,\n matching,\n
view_list;\n tab_list = [],\n
gadget = this;\n
\n \n
return gadget.jio_get({"_id": options.jio_key})\n return gadget.jio_get({"_id": options.jio_key})\n
.push(function (result) {\n .push(function (result) {\n
...@@ -177,8 +178,7 @@ ...@@ -177,8 +178,7 @@
return RSVP.all(promise_list);\n return RSVP.all(promise_list);\n
})\n })\n
.push(function (all_result) {\n .push(function (all_result) {\n
var i,\n var i;\n
tab_list = [];\n
\n \n
for (i = 0; i < all_result.length - 1; i += 1) {\n for (i = 0; i < all_result.length - 1; i += 1) {\n
tab_list.push({\n tab_list.push({\n
...@@ -188,8 +188,7 @@ ...@@ -188,8 +188,7 @@
});\n });\n
}\n }\n
\n \n
\n return gadget.translateHtml(table_template({\n
gadget.props.element.innerHTML = table_template({\n
definition_title: "Views",\n definition_title: "Views",\n
definition_i18n: "Views",\n definition_i18n: "Views",\n
definition_icon: "eye",\n definition_icon: "eye",\n
...@@ -202,16 +201,15 @@ ...@@ -202,16 +201,15 @@
definition_i18n: "Editables",\n definition_i18n: "Editables",\n
definition_icon: "edit",\n definition_icon: "edit",\n
documentlist: tab_list\n documentlist: tab_list\n
});\n }));\n
\n })\n
.push(function (my_translated_html) {\n
gadget.props.element.innerHTML = my_translated_html;\n
\n
return gadget.renderPageHeader({\n return gadget.renderPageHeader({\n
cancel_url: tab_list[matching].link\n cancel_url: tab_list[matching].link\n
});\n });\n
})\n
.push(function () {\n
return gadget.translateElementList(gadget.props.element);\n
});\n });\n
\n
});\n });\n
\n \n
}(window, rJS, RSVP, Handlebars)); }(window, rJS, RSVP, Handlebars));
...@@ -351,7 +349,7 @@ ...@@ -351,7 +349,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>939.52859.64388.5905</string> </value> <value> <string>939.62551.57559.50790</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -369,7 +367,7 @@ ...@@ -369,7 +367,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1419348765.01</float> <float>1419929834.4</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -122,7 +122,6 @@ ...@@ -122,7 +122,6 @@
\n \n
<!-- XXX widget-status is bad! -->\n <!-- XXX widget-status is bad! -->\n
<script id="panel-template" type="text/x-handlebars-template">\n <script id="panel-template" type="text/x-handlebars-template">\n
<form class="save_form document_form">\n
<div class="center">\n <div class="center">\n
<div class="ui-field-contain">\n <div class="ui-field-contain">\n
<div class="ui-input-text ui-body-{{widget_theme}} ui-corner-all ui-shadow-inset ui-input-has-clear {{widget_status_class}}">\n <div class="ui-input-text ui-body-{{widget_theme}} ui-corner-all ui-shadow-inset ui-input-has-clear {{widget_status_class}}">\n
...@@ -131,14 +130,14 @@ ...@@ -131,14 +130,14 @@
Submit<input data-enhanced="true" type="submit" data-i18n="[value]header-submit" value="Submit" {{widget_status_attribute}} />\n Submit<input data-enhanced="true" type="submit" data-i18n="[value]header-submit" value="Submit" {{widget_status_attribute}} />\n
</div>\n </div>\n
</div>\n </div>\n
<a href="#" data-i18n="header-filter" class="ui-btn ui-btn-{{widget_theme}} ui-btn-icon-notext ui-icon-filter ui-override-theme ui-disabled">Filters</a>\n <a href="#" data-i18n="filter" class="ui-btn ui-btn-{{widget_theme}} ui-btn-icon-notext ui-icon-filter ui-override-theme ui-disabled">Filters</a>\n
</div>\n </div>\n
</div>\n </div>\n
</form>\n
</script>\n </script>\n
\n \n
</head>\n </head>\n
<body>\n <body>\n
<form class="save_form document_form"></form>\n
</body>\n </body>\n
</html> </html>
...@@ -277,7 +276,7 @@ ...@@ -277,7 +276,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>939.43978.9403.31744</string> </value> <value> <string>939.54156.55991.39765</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -295,7 +294,7 @@ ...@@ -295,7 +294,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1419256755.64</float> <float>1419427478.55</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
......
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
//////////////////////////////////////////////\n //////////////////////////////////////////////\n
// acquired method\n // acquired method\n
//////////////////////////////////////////////\n //////////////////////////////////////////////\n
.declareAcquiredMethod("translateElementList", "translateElementList")\n .declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("pleasePublishMyState", "pleasePublishMyState")\n .declareAcquiredMethod("pleasePublishMyState", "pleasePublishMyState")\n
.declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n .declareAcquiredMethod("pleaseRedirectMyHash", "pleaseRedirectMyHash")\n
\n \n
...@@ -153,14 +153,19 @@ ...@@ -153,14 +153,19 @@
append_attribute = \' disabled="disabled\';\n append_attribute = \' disabled="disabled\';\n
}\n }\n
\n \n
search_gadget.props.element.innerHTML = panel_template({\n return new RSVP.Queue()\n
.push(function () {\n
return search_gadget.translateHtml(panel_template({\n
widget_value: option_dict.extended_search || placeholder,\n widget_value: option_dict.extended_search || placeholder,\n
widget_theme: option_dict.theme || "c",\n widget_theme: option_dict.theme || "c",\n
widget_status_attribute: append_attribute || placeholder,\n widget_status_attribute: append_attribute || placeholder,\n
widget_status_class: append_class || placeholder\n widget_status_class: append_class || placeholder\n
}));\n
})\n
.push(function (my_translated_html) {\n
search_gadget.props.element.querySelector("form").innerHTML = my_translated_html;\n
return search_gadget;\n
});\n });\n
\n
return search_gadget.translateElementList(search_gadget.props.element);\n
})\n })\n
\n \n
.declareMethod(\'getContent\', function () {\n .declareMethod(\'getContent\', function () {\n
...@@ -188,7 +193,6 @@ ...@@ -188,7 +193,6 @@
return search_form.pleaseRedirectMyHash(url);\n return search_form.pleaseRedirectMyHash(url);\n
});\n });\n
}\n }\n
\n
// Listen to form submit\n // Listen to form submit\n
return loopEventListener(\n return loopEventListener(\n
search_form.props.element.querySelector(\'form\'),\n search_form.props.element.querySelector(\'form\'),\n
...@@ -333,7 +337,7 @@ ...@@ -333,7 +337,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>939.52819.6586.23620</string> </value> <value> <string>939.62632.40457.51063</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -351,7 +355,7 @@ ...@@ -351,7 +355,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1419345824.09</float> <float>1419934628.57</float>
<string>GMT</string> <string>GMT</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