Commit d63ee187 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: improve readability

parent 9fa1ea05
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
////////////////////////////////////////////// //////////////////////////////////////////////
.declareAcquiredMethod("getUrlForList", "getUrlForList") .declareAcquiredMethod("getUrlForList", "getUrlForList")
.declareAcquiredMethod("getTranslationList", "getTranslationList") .declareAcquiredMethod("getTranslationList", "getTranslationList")
.declareAcquiredMethod("getTranslationDict", "getTranslationDict")
.declareAcquiredMethod("redirect", "redirect") .declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter") .declareAcquiredMethod("getUrlParameter", "getUrlParameter")
...@@ -174,8 +175,8 @@ ...@@ -174,8 +175,8 @@
queue queue
// Update the global links // Update the global links
.push(function () { .push(function () {
return RSVP.all([ return RSVP.hash({
gadget.getUrlForList([ url_list: gadget.getUrlForList([
{command: 'display'}, {command: 'display'},
{command: 'display', options: {page: "front"}}, {command: 'display', options: {page: "front"}},
{command: 'display', options: {page: "worklist"}}, {command: 'display', options: {page: "worklist"}},
...@@ -184,7 +185,7 @@ ...@@ -184,7 +185,7 @@
{command: 'display', options: {page: "preference"}}, {command: 'display', options: {page: "preference"}},
{command: 'display', options: {page: "logout"}} {command: 'display', options: {page: "logout"}}
]), ]),
gadget.getTranslationList([ translation_list: gadget.getTranslationList([
'Editable', 'Editable',
'Home', 'Home',
'Modules', 'Modules',
...@@ -194,10 +195,10 @@ ...@@ -194,10 +195,10 @@
'Preferences', 'Preferences',
'Logout' 'Logout'
]), ]),
gadget.getDeclaredGadget("erp5_checkbox") checkbox_gadget: gadget.getDeclaredGadget("erp5_checkbox")
]); });
}) })
.push(function (result_list) { .push(function (result_dict) {
var editable_value = [], var editable_value = [],
element_list = [], element_list = [],
icon_and_key_list = [ icon_and_key_list = [
...@@ -210,14 +211,14 @@ ...@@ -210,14 +211,14 @@
'power-off', 'o' 'power-off', 'o'
]; ];
for (i = 0; i < result_list[0].length; i += 1) { for (i = 0; i < result_dict.url_list.length; i += 1) {
// <li><a href="URL" class="ui-btn-icon-left ui-icon-ICON" data-i18n="TITLE" accesskey="KEY"></a></li> // <li><a href="URL" class="ui-btn-icon-left ui-icon-ICON" data-i18n="TITLE" accesskey="KEY"></a></li>
element_list.push(domsugar('li', [ element_list.push(domsugar('li', [
domsugar('a', { domsugar('a', {
href: result_list[0][i], href: result_dict.url_list[i],
'class': 'ui-btn-icon-left ui-icon-' + icon_and_key_list[2 * i], 'class': 'ui-btn-icon-left ui-icon-' + icon_and_key_list[2 * i],
accesskey: icon_and_key_list[2 * i + 1], accesskey: icon_and_key_list[2 * i + 1],
text: result_list[1][i + 1] text: result_dict.translation_list[i + 1]
}) })
])); ]));
} }
...@@ -228,12 +229,12 @@ ...@@ -228,12 +229,12 @@
if (gadget.state.editable) { if (gadget.state.editable) {
editable_value = ['editable']; editable_value = ['editable'];
} }
return result_list[2].render({field_json: { return result_dict.checkbox_gadget.render({field_json: {
editable: true, editable: true,
name: 'editable', name: 'editable',
key: 'editable', key: 'editable',
hidden: false, hidden: false,
items: [[result_list[1][0], 'editable']], items: [[result_dict.translation_list[0], 'editable']],
'default': editable_value 'default': editable_value
}}); }});
}); });
...@@ -269,25 +270,26 @@ ...@@ -269,25 +270,26 @@
).concat(clone_list).concat(jump_list).map(function (options) { ).concat(clone_list).concat(jump_list).map(function (options) {
return options.url_kw; return options.url_kw;
}); });
return RSVP.all([ return RSVP.hash({
gadget.getUrlForList(parameter_list), url_list: gadget.getUrlForList(parameter_list),
gadget.getTranslationList(['Views', 'Workflows', 'Actions', translation_dict: gadget.getTranslationDict([
'Jumps']) 'Views', 'Workflows', 'Actions', 'Jumps'
]); ])
});
}) })
.push(function (result_list) { .push(function (result_dict) {
appendDt(dl_fragment, result_list[1][0], 'eye', appendDt(dl_fragment, result_dict.translation_dict.Views, 'eye',
view_list, result_list[0], 0); view_list, result_dict.url_list, 0);
if (gadget.state.display_workflow_list) { if (gadget.state.display_workflow_list) {
// show Workflows only on document // show Workflows only on document
appendDt(dl_fragment, result_list[1][1], 'random', appendDt(dl_fragment, result_dict.translation_dict.Workflows, 'random',
workflow_list, result_list[0], view_list.length); workflow_list, result_dict.url_list, view_list.length);
} }
appendDt(dl_fragment, result_list[1][2], 'cogs', appendDt(dl_fragment, result_dict.translation_dict.Actions, 'cogs',
action_list.concat(clone_list), result_list[0], action_list.concat(clone_list), result_dict.url_list,
view_list.length + workflow_list.length); view_list.length + workflow_list.length);
appendDt(dl_fragment, result_list[1][3], 'plane', appendDt(dl_fragment, result_dict.translation_dict.Jumps, 'plane',
jump_list, result_list[0], jump_list, result_dict.url_list,
view_list.length + workflow_list.length + view_list.length + workflow_list.length +
action_list.length + clone_list.length); action_list.length + clone_list.length);
}); });
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>994.51061.29790.4608</string> </value> <value> <string>994.51079.60050.30071</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>1631621138.31</float> <float>1631622266.86</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