Commit 1e40556a authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: fixup do not include useless parameters in the url

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