Commit f25237bf authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: do not include useless parameters in the url

fixup nexedi/erp5@e21968ba
parent cde13458
...@@ -172,6 +172,7 @@ ...@@ -172,6 +172,7 @@
action_type, action_type,
current_href, current_href,
class_name, class_name,
extra_options,
options, options,
command, command,
group_mapping = {}, group_mapping = {},
...@@ -256,29 +257,35 @@ ...@@ -256,29 +257,35 @@
group_mapping[group][i].action_type.indexOf("_raw") !== -1) { group_mapping[group][i].action_type.indexOf("_raw") !== -1) {
command = "raw"; command = "raw";
options = { options = {
title: group_mapping[group][i].title,
url: group_mapping[group][i].href url: group_mapping[group][i].href
}; };
extra_options = {
title: group_mapping[group][i].title
};
} else { } else {
command = command_mapping[group] || default_command_mapping[group]; command = command_mapping[group] || default_command_mapping[group];
options = { options = {
title: group_mapping[group][i].title,
class_name: class_name,
jio_key: jio_key, jio_key: jio_key,
view: group_mapping[group][i].href, view: group_mapping[group][i].href,
editable: editable_mapping[group] editable: editable_mapping[group]
}; };
extra_options = {
title: group_mapping[group][i].title,
class_name: class_name
};
} }
if (group === "view") { if (group === "view") {
// Views in ERP5 must be forms but because of // Views in ERP5 must be forms but because of
// OfficeJS we keep it empty for different default // OfficeJS we keep it empty for different default
options.page = undefined; options.page = undefined;
} }
url_mapping[group].push({
extra_options.url_kw = {
command: command, command: command,
absolute_url: command === "raw" ? true : false, absolute_url: command === "raw" ? true : false,
options: options options: options
}); };
url_mapping[group].push(extra_options);
} }
} }
} }
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>990.47062.36646.8226</string> </value> <value> <string>991.63236.62412.49203</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>1615825369.82</float> <float>1620739824.54</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
for (i = 0; i < group_list.length; i += 2) { for (i = 0; i < group_list.length; i += 2) {
for (j = 0; j < group_list[i].length; j += 1) { for (j = 0; j < group_list[i].length; j += 1) {
url_for_kw_list.push(group_list[i][j]); url_for_kw_list.push(group_list[i][j].url_kw);
} }
} }
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
link_list = []; link_list = [];
for (j = 0; j < group_list[i].length; j += 1) { for (j = 0; j < group_list[i].length; j += 1) {
link_list.push({ link_list.push({
title: group_list[i][j].options.title, title: group_list[i][j].title,
link: result_dict.url_list[k] link: result_dict.url_list[k]
}); });
k += 1; k += 1;
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>990.5865.43433.1774</string> </value> <value> <string>991.59072.18419.59613</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>1613612772.39</float> <float>1620395667.38</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -24,12 +24,12 @@ ...@@ -24,12 +24,12 @@
dd_element = document.createElement('dd'); dd_element = document.createElement('dd');
dd_element.setAttribute('class', 'document-listview'); dd_element.setAttribute('class', 'document-listview');
a_element = document.createElement('a'); a_element = document.createElement('a');
if (action_list[i].options && action_list[i].options.class_name) { if (action_list[i].class_name) {
// Avoid add class='undefined' in HTML // Avoid add class='undefined' in HTML
a_element.setAttribute('class', action_list[i].options.class_name); a_element.setAttribute('class', action_list[i].class_name);
} }
a_element.href = href_list[index + i]; a_element.href = href_list[index + i];
a_element.textContent = action_list[i].options.title; a_element.textContent = action_list[i].title;
dd_element.appendChild(a_element); dd_element.appendChild(a_element);
fragment.appendChild(dd_element); fragment.appendChild(dd_element);
} }
...@@ -277,7 +277,9 @@ ...@@ -277,7 +277,9 @@
parameter_list = view_list.concat(workflow_list).concat( parameter_list = view_list.concat(workflow_list).concat(
action_list action_list
).concat(clone_list).concat(jump_list); ).concat(clone_list).concat(jump_list).map(function (options) {
return options.url_kw;
});
return RSVP.all([ return RSVP.all([
gadget.getUrlForList(parameter_list), gadget.getUrlForList(parameter_list),
gadget.getTranslationList(['Views', 'Workflows', 'Actions', gadget.getTranslationList(['Views', 'Workflows', 'Actions',
...@@ -311,11 +313,11 @@ ...@@ -311,11 +313,11 @@
var extra_menu_list = JSON.parse(gadget.state.extra_menu_list), var extra_menu_list = JSON.parse(gadget.state.extra_menu_list),
href_list = []; href_list = [];
for (i = 0; i < extra_menu_list.length; i += 1) { for (i = 0; i < extra_menu_list.length; i += 1) {
extra_menu_list[i].options = { href_list.push(extra_menu_list[i].href);
extra_menu_list[i] = {
"class_name": extra_menu_list[i].active ? "active" : "", "class_name": extra_menu_list[i].active ? "active" : "",
"title": extra_menu_list[i].title "title": extra_menu_list[i].title
}; };
href_list.push(extra_menu_list[i].href);
} }
appendDt(dl_fragment, translation_list[0], 'globe', appendDt(dl_fragment, translation_list[0], 'globe',
extra_menu_list, href_list, 0); extra_menu_list, href_list, 0);
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>990.38408.14.44134</string> </value> <value> <string>991.63550.23294.43315</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>1615306118.36</float> <float>1620660511.51</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -113,7 +113,8 @@ ...@@ -113,7 +113,8 @@
view_list = group_mapping.view; view_list = group_mapping.view;
jump_list = group_mapping.action_object_jio_jump; jump_list = group_mapping.action_object_jio_jump;
url_for_kw_list = url_for_kw_list.concat(view_list).concat(jump_list); url_for_kw_list = url_for_kw_list.concat(view_list).concat(jump_list)
.map(function (options) {return options.url_kw; });
url_for_kw_list.push({command: 'cancel_dialog_with_history'}); url_for_kw_list.push({command: 'cancel_dialog_with_history'});
return RSVP.hash({ return RSVP.hash({
...@@ -131,14 +132,14 @@ ...@@ -131,14 +132,14 @@
for (i = 0; i < view_list.length; i += 1) { for (i = 0; i < view_list.length; i += 1) {
tab_list.push({ tab_list.push({
title: view_list[i].options.title, title: view_list[i].title,
link: result_dict.url_list[j] link: result_dict.url_list[j]
}); });
j += 1; j += 1;
} }
for (i = 0; i < jump_list.length; i += 1) { for (i = 0; i < jump_list.length; i += 1) {
jump_action_list.push({ jump_action_list.push({
title: jump_list[i].options.title, title: jump_list[i].title,
link: result_dict.url_list[j] link: result_dict.url_list[j]
}); });
j += 1; j += 1;
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>990.58741.8.36061</string> </value> <value> <string>991.63294.25048.8021</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>1616691370.71</float> <float>1620645031.39</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