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

erp5_web_renderjs_ui: improved translation handling and cleanup

parent 1f5af98b
......@@ -286,10 +286,8 @@
if (options.hasOwnProperty("breadcrumb_url")) {\n
title_link.url = options.breadcrumb_url;\n
promise_list.push(gadget.translateHtml(header_title_link_template(title_link)));\n
//gadget.props.title_element.innerHTML = header_title_link_template(title_link);\n
} else {\n
promise_list.push(gadget.translateHtml(header_title_template(title_link)));\n
//gadget.props.title_element.innerHTML = header_title_template(title_link);\n
}\n
\n
// Handle left link\n
......@@ -317,13 +315,10 @@
}\n
}\n
if (left_button !== undefined) {\n
//gadget.props.left_link.innerHTML = header_button_template(left_button);\n
promise_list.push(gadget.translateHtml(header_button_template(left_button)));\n
} else if (left_link === undefined) {\n
//gadget.props.left_link.innerHTML = "";\n
promise_list.push(gadget.translateHtml(""));\n
} else {\n
// gadget.props.left_link.innerHTML = header_link_template(left_link);\n
promise_list.push(gadget.translateHtml(header_link_template(left_link)));\n
}\n
\n
......@@ -373,13 +368,10 @@
}\n
if (right_button !== undefined) {\n
promise_list.push(gadget.translateHtml(header_button_template(right_button)));\n
//gadget.props.right_link.innerHTML = header_button_template(right_button);\n
} else if (right_link !== undefined) {\n
promise_list.push(gadget.translateHtml(header_link_template(right_link)));\n
//gadget.props.right_link.innerHTML = header_link_template(right_link);\n
} else {\n
promise_list.push(gadget.translateHtml(""));\n
//gadget.props.right_link.innerHTML = "";\n
}\n
\n
// Handle sub header\n
......@@ -408,6 +400,7 @@
//gadget.props.sub_header_ul.innerHTML = sub_header_template({\n
// sub_header_list: sub_header_list\n
//});\n
\n
promise_list.push(gadget.translateHtml(sub_header_template({\n
sub_header_list: sub_header_list\n
})));\n
......@@ -588,7 +581,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.1374.53791.13363</string> </value>
<value> <string>940.2108.16108.5614</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -606,7 +599,7 @@
</tuple>
<state>
<tuple>
<float>1420191334.15</float>
<float>1420237508.03</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -204,7 +204,6 @@
}).push(function (result) {\n
var promise_list = [result];\n
counter = Math.min(result.data.total_rows, lines);\n
\n
for (i = 0; i < counter; i += 1) {\n
promise_list.push(\n
gadget.whoWantToDisplayThis(result.data.rows[i].id)\n
......@@ -272,6 +271,8 @@
paging_info = document.createElement("span"),\n
paging_menu = document.createElement("div"),\n
paging_wrap = document.createElement("div"),\n
temp = document.createElement("div"),\n
temp_table = document.createElement("table"),\n
len;\n
\n
th.setAttribute("colspan", field_json.column_list.length);\n
......@@ -322,14 +323,18 @@
for (len = table.children.length; len > 0; len -= 1) {\n
table.removeChild(table.lastChild);\n
}\n
\n
table.appendChild(fragment);\n
\n
// XXX: DOM touches\n
return gadget.translateHtml(gadget.props.element.innerHTML);\n
// NOTE: for passing translations, temp must contain a table\n
temp_table.appendChild(fragment);\n
temp.appendChild(temp_table);\n
\n
return gadget.translateHtml(temp.innerHTML);\n
})\n
.push(function (my_translated_html) {\n
gadget.props.element.innerHTML = my_translated_html;\n
var temp = document.createElement("div");\n
\n
temp.innerHTML = my_translated_html;\n
gadget.props.element.appendChild(temp.firstElementChild);\n
return gadget;\n
});\n
});\n
......@@ -471,7 +476,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>939.51316.12701.36232</string> </value>
<value> <string>940.2150.5227.15428</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -489,7 +494,7 @@
</tuple>
<state>
<tuple>
<float>1419419239.32</float>
<float>1420237871.41</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -147,6 +147,7 @@
.declareMethod("render", function (options) {\n
var gadget = this,\n
erp5_document,\n
result_list,\n
view_list;\n
\n
return gadget.jio_get({"_id": options.jio_key})\n
......@@ -173,6 +174,8 @@
.push(function (all_result) {\n
var i,\n
tab_list = [];\n
\n
result_list = all_result;\n
\n
for (i = 2; i < all_result.length; i += 1) {\n
tab_list.push({\n
......@@ -181,29 +184,22 @@
i18n: view_list[i - 2].title\n
});\n
}\n
\n
\n
gadget.props.element.innerHTML = table_template({\n
\n
return gadget.translateHtml(table_template({\n
definition_title: "Workflow Transitions",\n
documentlist: tab_list,\n
definition_i18n: "Workflow-Transitions"\n
});\n
})); \n
})\n
.push(function (my_translated_html) {\n
gadget.props.element.innerHTML = my_translated_html;\n
\n
return gadget.renderPageHeader({\n
back_url: all_result[0],\n
back_url: result_list[0],\n
page_title: erp5_document.title,\n
breadcrumb_url: all_result[1]\n
breadcrumb_url: result_list[1]\n
});\n
})\n
// XXX: DOM touches\n
.push(function () {\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
}(window, rJS, RSVP, Handlebars));
......@@ -343,7 +339,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>939.52883.40109.10154</string> </value>
<value> <string>940.2136.15566.12765</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -361,7 +357,7 @@
</tuple>
<state>
<tuple>
<float>1419417919.94</float>
<float>1420237984.64</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -198,21 +198,15 @@
return parent_queue;\n
})\n
.push(function () {\n
gadget.props.element.innerHTML = table_template({\n
return gadget.translateHtml(table_template({\n
definition_title: "Breadcrumb",\n
documentlist: parent_list\n
});\n
\n
return gadget.renderPageHeader(header_options);\n
})\n
// XXX: DOM touches\n
.push(function () {\n
return gadget.translateHtml(gadget.props.element.innerHTML);\n
}));\n
})\n
.push(function (my_translated_html) {\n
gadget.props.element.innerHTML = my_translated_html;\n
return gadget.renderPageHeader(header_options);\n
});\n
\n
});\n
\n
}(window, rJS, RSVP, Handlebars, URI));</string> </value>
......@@ -350,7 +344,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>939.52887.29595.20992</string> </value>
<value> <string>940.1898.34631.55091</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -368,7 +362,7 @@
</tuple>
<state>
<tuple>
<float>1419417866.54</float>
<float>1420236895.39</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -228,7 +228,8 @@
return gadget.translateHtml(result_html);\n
})\n
.push(function (my_translated_html) {\n
gadget.props.element.querySelector(\'.document_list\').innerHTML = my_translated_html;\n
gadget.props.element.querySelector(\'.document_list\').innerHTML =\n
my_translated_html;\n
});\n
});\n
}(window, rJS, RSVP, Handlebars));
......@@ -368,7 +369,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>939.43978.9403.31744</string> </value>
<value> <string>940.1897.57739.49578</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -386,7 +387,7 @@
</tuple>
<state>
<tuple>
<float>1419417516.48</float>
<float>1420236486.36</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -163,7 +163,8 @@
}));\n
})\n
.push(function (my_translated_html) {\n
search_gadget.props.element.querySelector("form").innerHTML = my_translated_html;\n
search_gadget.props.element.querySelector("form").innerHTML = \n
my_translated_html;\n
return search_gadget;\n
});\n
})\n
......@@ -337,7 +338,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>939.62632.40457.51063</string> </value>
<value> <string>940.1897.14544.10120</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -355,7 +356,7 @@
</tuple>
<state>
<tuple>
<float>1419934628.57</float>
<float>1420236368.31</float>
<string>GMT</string>
</tuple>
</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