Commit 257808cc authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

Crib SW Gadget: Crib Enable Gadget is defined by local variable

* Effectively this allows to edit two Sites at the same time in two
differents tabs
* It also to not change the site you are editing in a tab by changing it
in another tab
parent 45d87016
......@@ -3,12 +3,21 @@
(function (window, rJS, RSVP, jIO) {
"use strict";
function getStorageGadget(gadget) {
function getStorageGadget(gadget, new_url) {
var storage_gadget, site_editor_gadget_url, getURL = window.location;
return gadget.getSetting(
"site_editor_gadget_url",
getURL.protocol + "//" + getURL.host + "/crib-enable.html"
)
return RSVP.Queue()
.push(function () {
if (new_url) {
return new_url;
} else if (!gadget.props.storage_gadget_url) {
return gadget.getSetting(
"site_editor_gadget_url",
getURL.protocol + "//" + getURL.host + "/crib-enable.html"
);
} else {
return gadget.props.storage_gadget_url;
}
})
.push(function (url) {
if (gadget.props.storage_gadget_url == url) {
return gadget.getDeclaredGadget("storage")
......@@ -54,7 +63,7 @@
try {
new URL(string);
} catch (_) {
return false
return false;
}
return true;
}
......@@ -151,14 +160,14 @@
// run accidently in a possible bug in RenderJS when the same gadget
// is declared twice in parallel. CLN needs to reproduce and
// investigate this issue.
return getStorageGadget(gadget);
return getStorageGadget(gadget, url);
});
})
.declareMethod('getCribEnableGadgetUrl', function (url) {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.getSetting("site_editor_gadget_url");
return gadget.props.storage_gadget_url;
});
});
......
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