Commit e59a7e4d authored by Roque's avatar Roque

erp5_officejs: controller handles app view action reference

parent b3cff650
/*global document, window, rJS */
/*global document, window, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (document, window, rJS) {
(function (document, window, rJS, RSVP) {
"use strict";
rJS(window)
......@@ -27,18 +27,25 @@
.declareMethod("render", function (options) {
var gadget = this,
//TODO get default and app views from app configuration
app_view = options.action || "text_editor_view",
default_view = "jio_view",
common_utils_gadget_url = "gadget_officejs_common_utils.html",
default_view,
app_view,
form_definition,
gadget_utils,
jio_document,
portal_type,
front_page;
return gadget.declareGadget(common_utils_gadget_url)
.push(function (result) {
gadget_utils = result;
return RSVP.Queue()
.push(function () {
return RSVP.all([
gadget.declareGadget("gadget_officejs_common_utils.html"),
gadget.getSetting('app_view_reference'),
gadget.getSetting('default_view_reference')
]);
})
.push(function (result_list) {
gadget_utils = result_list[0];
app_view = options.action || result_list[1];
default_view = result_list[2];
return gadget.jio_get(options.jio_key);
})
.push(function (result) {
......@@ -64,7 +71,6 @@
.push(function (result) {
return result;
}, function (error) {
console.log("Error getting app_view " + app_view + " for portal_type " + portal_type + ". Now trying with default_view " + default_view);
return gadget_utils.getFormDefinition(portal_type, default_view);
})
.push(function (result) {
......@@ -135,4 +141,4 @@
});
});
}(document, window, rJS));
\ No newline at end of file
}(document, window, rJS, RSVP));
\ No newline at end of file
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>976.29901.4312.20343</string> </value>
<value> <string>976.31188.39410.57719</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1560785129.07</float>
<float>1560859510.75</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -375,6 +375,16 @@
<value> <string>lines</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_app_view_action_reference</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
......@@ -426,6 +436,10 @@
</tuple>
</value>
</item>
<item>
<key> <string>configuration_app_view_action_reference</string> </key>
<value> <string>text_editor_view</string> </value>
</item>
<item>
<key> <string>configuration_application_title</string> </key>
<value> <string>Text Editor</string> </value>
......@@ -759,7 +773,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>976.29963.55292.21623</string> </value>
<value> <string>976.31037.397.45636</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -777,7 +791,7 @@
</tuple>
<state>
<tuple>
<float>1560786002.25</float>
<float>1560857896.33</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