Commit 654b5a49 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Form view: use getUrlForList

parent e4eacdcc
......@@ -29,7 +29,7 @@
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("getUrlForList", "getUrlForList")
.declareAcquiredMethod('isDesktopMedia', 'isDesktopMedia')
.declareAcquiredMethod('getUrlParameter', 'getUrlParameter')
......@@ -98,49 +98,53 @@
return embedded_form_gadget.render(form_options);
})
// render the header
.push(function () {
var url_for_parameter_list = [
{command: 'change', options: {page: "tab"}},
{command: 'change', options: {page: "action"}},
{command: 'history_previous'},
{command: 'selection_previous'},
{command: 'selection_next'},
{command: 'change', options: {page: "export"}},
{command: 'change', options: {editable: true}}
];
if (gadget.state.erp5_document._links.action_object_new_content_action) {
url_for_parameter_list.push({command: 'change', options: {
view: gadget.state.erp5_document._links.action_object_new_content_action.href,
editable: true
}});
}
return RSVP.all([
gadget.getUrlFor({command: 'change', options: {editable: true}}),
gadget.getUrlFor({command: 'change', options: {page: "action"}}),
gadget.getUrlFor({command: 'history_previous'}),
gadget.getUrlFor({command: 'selection_previous'}),
gadget.getUrlFor({command: 'selection_next'}),
gadget.getUrlFor({command: 'change', options: {page: "tab"}}),
(gadget.state.erp5_document._links.action_object_jio_report ||
gadget.state.erp5_document._links.action_object_jio_exchange ||
gadget.state.erp5_document._links.action_object_jio_print) ?
gadget.getUrlFor({command: 'change', options: {page: "export"}}) :
"",
calculatePageTitle(gadget, gadget.state.erp5_document),
gadget.isDesktopMedia(),
gadget.state.erp5_document._links.action_object_new_content_action ?
gadget.getUrlFor({command: 'change', options: {
view: gadget.state.erp5_document._links.action_object_new_content_action.href,
editable: true
}}) :
"",
gadget.getUrlParameter('selection_index')
gadget.getUrlParameter('selection_index'),
gadget.getUrlForList(url_for_parameter_list)
]);
})
.push(function (all_result) {
var options = {
edit_url: all_result[0],
actions_url: all_result[1],
selection_url: all_result[2],
// Only display previous/next links if url has a selection_index,
// ie, if we can paginate the result list of the search
previous_url: all_result[10] ? all_result[3] : '',
next_url: all_result[10] ? all_result[4] : '',
tab_url: all_result[5],
export_url: all_result[6],
page_title: all_result[7]
},
is_desktop = all_result[8];
if (is_desktop) {
options.add_url = all_result[9];
.push(function (result_list) {
var url_list = result_list[3],
header_dict = {
edit_url: url_list[6],
tab_url: url_list[0],
actions_url: url_list[1],
export_url: (
gadget.state.erp5_document._links.action_object_jio_report ||
gadget.state.erp5_document._links.action_object_jio_exchange ||
gadget.state.erp5_document._links.action_object_jio_print
) ? url_list[5] : '',
selection_url: url_list[2],
// Only display previous/next links if url has a selection_index,
// ie, if we can paginate the result list of the search
previous_url: result_list[2] ? url_list[3] : '',
next_url: result_list[2] ? url_list[4] : '',
page_title: result_list[0]
};
if (result_list[1]) {
header_dict.add_url = url_list[7] || '';
}
return gadget.updateHeader(options);
return gadget.updateHeader(header_dict);
});
});
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>967.44748.35225.6109</string> </value>
<value> <string>971.20608.16074.36249</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1536323414.72</float>
<float>1541766962.45</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