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 @@
setting;
this.props = {
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
......@@ -193,7 +196,7 @@
})
.push(function () {
return setting_gadget.get("setting")
return setting_gadget.get(gadget.props.setting_id)
.push(undefined, function (error) {
if (error.status_code === 404) {
return {};
......@@ -236,7 +239,7 @@
}
}
return setting_gadget.put("setting", setting);
return setting_gadget.put(gadget.props.setting_id, setting);
})
.push(function () {
// Configure jIO storage
......@@ -269,7 +272,7 @@
default_value = argument_list[1];
return gadget.getDeclaredGadget("setting_gadget")
.push(function (jio_gadget) {
return jio_gadget.get("setting");
return jio_gadget.get(gadget.props.setting_id);
})
.push(function (doc) {
return doc[key] || default_value;
......@@ -288,7 +291,7 @@
return gadget.getDeclaredGadget("setting_gadget")
.push(function (result) {
jio_gadget = result;
return jio_gadget.get("setting");
return jio_gadget.get(gadget.props.setting_id);
})
.push(undefined, function (error) {
if (error.status_code === 404) {
......@@ -298,7 +301,7 @@
})
.push(function (doc) {
doc[key] = value;
return jio_gadget.put('setting', doc);
return jio_gadget.put(gadget.props.setting_id, doc);
});
})
.allowPublicAcquisition("translateHtml", function (argument_list) {
......
......@@ -216,7 +216,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <string>vincent</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>960.2672.38593.36659</string> </value>
<value> <string>963.7551.15104.28279</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1497443691.6</float>
<float>1509376504.09</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