Commit 532fb013 authored by Vincent Bechu's avatar Vincent Bechu

[erp5_web_renderjs_ui] Add application title to setting id

In order to use setting in multiple application on same domain.
parent caeee0e1
...@@ -179,7 +179,10 @@ ...@@ -179,7 +179,10 @@
setting; setting;
this.props = { this.props = {
loading_counter: 0, loading_counter: 0,
content_element: this.element.querySelector('.gadget-content') content_element: this.element.querySelector('.gadget-content'),
setting_id: "setting/" + document.head.querySelector(
'script[data-renderjs-configuration="application_title"]'
).textContent
}; };
// Configure setting storage // Configure setting storage
...@@ -193,7 +196,7 @@ ...@@ -193,7 +196,7 @@
}) })
.push(function () { .push(function () {
return setting_gadget.get("setting") return setting_gadget.get(gadget.props.setting_id)
.push(undefined, function (error) { .push(undefined, function (error) {
if (error.status_code === 404) { if (error.status_code === 404) {
return {}; return {};
...@@ -236,7 +239,7 @@ ...@@ -236,7 +239,7 @@
} }
} }
return setting_gadget.put("setting", setting); return setting_gadget.put(gadget.props.setting_id, setting);
}) })
.push(function () { .push(function () {
// Configure jIO storage // Configure jIO storage
...@@ -269,7 +272,7 @@ ...@@ -269,7 +272,7 @@
default_value = argument_list[1]; default_value = argument_list[1];
return gadget.getDeclaredGadget("setting_gadget") return gadget.getDeclaredGadget("setting_gadget")
.push(function (jio_gadget) { .push(function (jio_gadget) {
return jio_gadget.get("setting"); return jio_gadget.get(gadget.props.setting_id);
}) })
.push(function (doc) { .push(function (doc) {
return doc[key] || default_value; return doc[key] || default_value;
...@@ -288,7 +291,7 @@ ...@@ -288,7 +291,7 @@
return gadget.getDeclaredGadget("setting_gadget") return gadget.getDeclaredGadget("setting_gadget")
.push(function (result) { .push(function (result) {
jio_gadget = result; jio_gadget = result;
return jio_gadget.get("setting"); return jio_gadget.get(gadget.props.setting_id);
}) })
.push(undefined, function (error) { .push(undefined, function (error) {
if (error.status_code === 404) { if (error.status_code === 404) {
...@@ -298,7 +301,7 @@ ...@@ -298,7 +301,7 @@
}) })
.push(function (doc) { .push(function (doc) {
doc[key] = value; doc[key] = value;
return jio_gadget.put('setting', doc); return jio_gadget.put(gadget.props.setting_id, doc);
}); });
}) })
.allowPublicAcquisition("translateHtml", function (argument_list) { .allowPublicAcquisition("translateHtml", function (argument_list) {
......
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>zope</string> </value> <value> <string>vincent</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.2672.38593.36659</string> </value> <value> <string>963.7551.15104.28279</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>1497443691.6</float> <float>1509376504.09</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