Commit 379fa45b authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

CribSWGadget: Add dedicated method to change crib enable gadget

parent 3e455dfc
......@@ -383,6 +383,14 @@
.allowPublicAcquisition("crib_sw_getScope", function (param_list) {
return callCribSWGadget(this, "getScope", param_list);
})
.allowPublicAcquisition("crib_sw_setCribEnableGadgetUrl",
function (param_list) {
return callCribSWGadget(this, "setCribEnableGadgetUrl", param_list);
})
.allowPublicAcquisition("crib_sw_getCribEnableGadgetUrl",
function (param_list) {
return callCribSWGadget(this, "getCribEnableGadgetUrl", param_list);
})
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
......
......@@ -65,6 +65,7 @@
return getStorageGadget(gadget);
})
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareMethod('allDocs', function (params) {
return getStorageGadget(this)
.push(function (storage_gadget) {
......@@ -117,6 +118,28 @@
.push(function (storage_gadget) {
return storage_gadget.getScope();
});
})
.declareMethod('setCribEnableGadgetUrl', function (url) {
var gadget = this;
// XXX Should perform checks
return new RSVP.Queue()
.push(function () {
return gadget.setSetting("site_editor_gadget_url", url);
})
.push(function () {
// XXX CLN Needs to call that one here in order to make sure we do not
// 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);
});
})
.declareMethod('getCribEnableGadgetUrl', function (url) {
var gadget = this;
return new RSVP.Queue()
.push(function () {
return gadget.getSetting("site_editor_gadget_url");
});
});
}(window, rJS, RSVP, jIO));
\ No newline at end of file
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