Commit fd299b3d authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Display more links in desktop mode

parent 7d59d147
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
.declareAcquiredMethod("notifyChange", "notifyChange") .declareAcquiredMethod("notifyChange", "notifyChange")
.declareAcquiredMethod("displayFormulatorValidationError", .declareAcquiredMethod("displayFormulatorValidationError",
"displayFormulatorValidationError") "displayFormulatorValidationError")
.declareAcquiredMethod('isDesktopMedia', 'isDesktopMedia')
.allowPublicAcquisition("notifyChange", function () { .allowPublicAcquisition("notifyChange", function () {
return this.notifyChange({modified: true}); return this.notifyChange({modified: true});
}) })
...@@ -80,22 +81,23 @@ ...@@ -80,22 +81,23 @@
// render the header // render the header
.push(function () { .push(function () {
var new_content_action = form_gadget.state.erp5_document._links.action_object_new_content_action;
if (new_content_action !== undefined) {
new_content_action = form_gadget.getUrlFor({command: 'change', options: {view: new_content_action.href, editable: true}});
} else {
new_content_action = "";
}
return RSVP.all([ return RSVP.all([
form_gadget.getUrlFor({command: 'change', options: {page: "tab"}}), form_gadget.getUrlFor({command: 'change', options: {page: "tab"}}),
form_gadget.getUrlFor({command: 'change', options: {page: "action"}}), form_gadget.getUrlFor({command: 'change', options: {page: "action"}}),
new_content_action, form_gadget.state.erp5_document._links.action_object_new_content_action ?
form_gadget.getUrlFor({command: 'change', options: {
view: form_gadget.state.erp5_document._links.action_object_new_content_action.href,
editable: true
}}) :
"",
form_gadget.getUrlFor({command: 'history_previous'}), form_gadget.getUrlFor({command: 'history_previous'}),
form_gadget.getUrlFor({command: 'selection_previous'}), form_gadget.getUrlFor({command: 'selection_previous'}),
form_gadget.getUrlFor({command: 'selection_next'}), form_gadget.getUrlFor({command: 'selection_next'}),
calculatePageTitle(form_gadget, form_gadget.state.erp5_document) calculatePageTitle(form_gadget, form_gadget.state.erp5_document),
form_gadget.isDesktopMedia(),
form_gadget.state.erp5_document._links.action_object_jio_report ?
form_gadget.getUrlFor({command: 'change', options: {page: "export"}}) :
""
]); ]);
}) })
.push(function (all_result) { .push(function (all_result) {
...@@ -107,10 +109,14 @@ ...@@ -107,10 +109,14 @@
previous_url: all_result[4], previous_url: all_result[4],
next_url: all_result[5], next_url: all_result[5],
page_title: all_result[6] page_title: all_result[6]
}; },
is_desktop = all_result[7];
if (form_gadget.state.save_action === true) { if (form_gadget.state.save_action === true) {
header_dict.save_action = true; header_dict.save_action = true;
} }
if (is_desktop) {
header_dict.export_url = all_result[8];
}
return form_gadget.updateHeader(header_dict); return form_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>965.14609.38920.44509</string> </value> <value> <string>965.39385.16585.60774</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>1517561386.33</float> <float>1519047926.74</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getUrlFor", "getUrlFor") .declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod('isDesktopMedia', 'isDesktopMedia')
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Proxy methods to the child gadget // Proxy methods to the child gadget
...@@ -100,13 +101,20 @@ ...@@ -100,13 +101,20 @@
gadget.getUrlFor({command: 'selection_next'}), gadget.getUrlFor({command: 'selection_next'}),
gadget.getUrlFor({command: 'change', options: {page: "tab"}}), gadget.getUrlFor({command: 'change', options: {page: "tab"}}),
gadget.state.erp5_document._links.action_object_jio_report ? gadget.state.erp5_document._links.action_object_jio_report ?
gadget.getUrlFor({command: 'change', options: {page: "export"}}) : gadget.getUrlFor({command: 'change', options: {page: "export"}}) :
"", "",
calculatePageTitle(gadget, gadget.state.erp5_document) 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
}}) :
""
]); ]);
}) })
.push(function (all_result) { .push(function (all_result) {
return gadget.updateHeader({ var options = {
edit_url: all_result[0], edit_url: all_result[0],
actions_url: all_result[1], actions_url: all_result[1],
selection_url: all_result[2], selection_url: all_result[2],
...@@ -115,7 +123,12 @@ ...@@ -115,7 +123,12 @@
tab_url: all_result[5], tab_url: all_result[5],
export_url: all_result[6], export_url: all_result[6],
page_title: all_result[7] page_title: all_result[7]
}); },
is_desktop = all_result[8];
if (is_desktop) {
options.add_url = all_result[9];
}
return gadget.updateHeader(options);
}); });
}); });
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>965.14600.20468.49988</string> </value> <value> <string>965.39384.38396.19200</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>1517561447.52</float> <float>1519047884.69</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