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