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

[erp5_web_renderjs_ui] Form view: use getUrlForList

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