diff --git a/www/admin/inner.js b/www/admin/inner.js index 4ebe0de82..1f18dfb5a 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -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]); } }); diff --git a/www/common/inner/sidebar-layout.js b/www/common/inner/sidebar-layout.js index 9df1ac220..cb34d37af 100644 --- a/www/common/inner/sidebar-layout.js +++ b/www/common/inner/sidebar-layout.js @@ -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);