mirror of https://github.com/xwiki-labs/cryptpad
Fix sidebar links after refactoring
This commit is contained in:
parent
5e61dd60f1
commit
62bcab59b9
|
@ -169,7 +169,7 @@ define([
|
|||
}
|
||||
};
|
||||
|
||||
const blocks = Sidebar.blocks('admin');
|
||||
const blocks = sidebar.blocks;
|
||||
|
||||
const flushCache = (cb) => {
|
||||
cb = cb || function () {};
|
||||
|
@ -199,7 +199,6 @@ define([
|
|||
|
||||
// Msg.admin_flushCacheHint, .admin_flushCacheTitle, .admin_flushCacheButton
|
||||
sidebar.addItem('flush-cache', function (cb) {
|
||||
const blocks = Sidebar.blocks('admin');
|
||||
var button = blocks.activeButton('primary', '',
|
||||
Messages.admin_flushCacheButton, done => {
|
||||
flushCache(function (e, data) {
|
||||
|
@ -3272,10 +3271,6 @@ define([
|
|||
$active.empty();
|
||||
if (Broadcast && Broadcast.surveyURL) {
|
||||
var a = blocks.link(Messages.admin_surveyActive, Broadcast.surveyURL);
|
||||
$(a).click(function (e) {
|
||||
e.preventDefault();
|
||||
common.openUnsafeURL(Broadcast.surveyURL);
|
||||
});
|
||||
$active.append([a, removeButton]);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
define([
|
||||
'jquery',
|
||||
'/api/config',
|
||||
'/components/nthen/index.js',
|
||||
'/common/common-interface.js',
|
||||
'/common/common-ui-elements.js',
|
||||
|
@ -13,6 +14,7 @@ define([
|
|||
'/common/hyperscript.js',
|
||||
], function(
|
||||
$,
|
||||
ApiConfig,
|
||||
nThen,
|
||||
UI,
|
||||
UIElements,
|
||||
|
@ -26,10 +28,22 @@ define([
|
|||
return key.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
|
||||
};
|
||||
|
||||
Sidebar.blocks = function (app) {
|
||||
Sidebar.blocks = function (app, common) {
|
||||
|
||||
let blocks = {};
|
||||
|
||||
// sframe-common shim
|
||||
if (!common) {
|
||||
common = {
|
||||
openURL: url => {
|
||||
window.open(url);
|
||||
},
|
||||
openUnsafeURL: url => {
|
||||
window.open(ApiConfig.httpSafeOrigin + '/bounce/#' + encodeURIComponent(url));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
blocks.labelledInput = (label, input, inputBlock) => {
|
||||
let uid = Util.uid();
|
||||
let id = `cp-${app}-item-${uid}`;
|
||||
|
@ -242,7 +256,6 @@ define([
|
|||
};
|
||||
|
||||
return blocks;
|
||||
|
||||
};
|
||||
|
||||
Sidebar.create = function (common, app, $container) {
|
||||
|
@ -253,7 +266,7 @@ define([
|
|||
$rightside
|
||||
};
|
||||
const items = {};
|
||||
sidebar.blocks = Sidebar.blocks(app);
|
||||
sidebar.blocks = Sidebar.blocks(app, common);
|
||||
|
||||
sidebar.addItem = (key, get, options) => {
|
||||
const safeKey = keyToCamlCase(key);
|
||||
|
|
Loading…
Reference in New Issue