Merge branch 'appconfig_ui' into 2024.6-test

This commit is contained in:
yflory 2024-06-24 15:15:44 +02:00
commit 03ea3f7c8e
7 changed files with 26 additions and 23 deletions

View File

@ -24,13 +24,13 @@
.cp-palette-nocolor {
display: none;
}
.instance-colors(@palette-colors; @index) when (@index > 0){
.instance-colors(@palette-colors; @index) when (@index > 0) {
// loop through the @colors
.instance-colors(@palette-colors; (@index - 1));
@color: extract(@palette-colors, @index);
// make a numbered class selector for each color
.cp-palette-color@{index}{
.cp-palette-color@{index} {
background-color: @color !important;
color: contrast(@color, @cryptpad_color_grey_800, @cryptpad_color_grey_200) !important;
}

View File

@ -52,7 +52,7 @@ nThen(function (w) {
if (err) { console.log(err); return; }
printLink();
}));
}).nThen(function (w) {
}).nThen(function () {
if (!Env.admins.length) {
Env.Log.info('NO_ADMIN_CONFIGURED', {
message: `Your instance is not correctly configured for production usage. Review its checkup page for more information.`,

View File

@ -215,7 +215,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) {
@ -997,7 +996,6 @@ define([
$input.val(hex);
onColorPicked();
});
var $colors = $(colors);
$(label).append(colors);
let form = blocks.form([
@ -3289,10 +3287,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]);
}
});

View File

@ -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);

View File

@ -17,11 +17,10 @@ define([
'/customize/pages.js',
'/common/rpc.js',
'onboardscreen.js',
'/common/inner/sidebar-layout.js',
'less!/install/onboarding.less',
'css!/components/components-font-awesome/css/font-awesome.min.css',
], function ($, Login, Cryptpad, /*Test,*/ Cred, UI, Util, Realtime, Constants, Feedback, LocalStore, h, Pages, Rpc, OnboardScreen, Sidebar) {
], function ($, Login, Cryptpad, /*Test,*/ Cred, UI, Util, Realtime, Constants, Feedback, LocalStore, h, Pages, Rpc, OnboardScreen) {
if (window.top !== window) { return; }
var Messages = Cryptpad.Messages;
$(function () {

View File

@ -136,7 +136,7 @@ define([
if (hasError) {
UI.alert(Messages.onboarding_save_error, function () {
document.location.href = '/drive/';
})
});
return;
}
document.location.href = '/drive/';
@ -233,7 +233,6 @@ define([
if (selections.colorId) {
colors.setValue(selections.colorId);
}
var $colors = $(colors).attr('id', 'cp-install-color');
var content = h('div.cp-onboardscreen-colorpick', [
h('label', {for:'cp-install-color'}, Messages.kanban_color),
colors
@ -242,7 +241,7 @@ define([
return content;
};
var button = blocks.activeButton('primary', '', Messages.continue, function (done) {
var button = blocks.activeButton('primary', '', Messages.continue, function () {
selections.title = $(titleInput).val() || '';
selections.description = $(description).val() || '';
if (dataURL) {
@ -330,7 +329,7 @@ define([
const grid = createAppsGrid(appsToDisable);
var save = blocks.activeButton('primary', '', Messages.continue, function (done) {
var save = blocks.activeButton('primary', '', Messages.continue, function () {
gotoPage(Env, 2);
});
@ -363,7 +362,7 @@ define([
label: 'registration',
query: function (val, setState) {
selections.closeRegistration = val;
setState(val)
setState(val);
},
});
@ -375,7 +374,7 @@ define([
label: 'forcemfa',
query: function (val, setState) {
selections.mfa = val;
setState(val)
setState(val);
},
});
@ -394,7 +393,6 @@ define([
], 'cp-admin-customize-options-grid');
var save = blocks.activeButton('primary', '', Messages.settings_save, function () {
saveAndRedirect(Env);
});

View File

@ -367,7 +367,6 @@ define([
// Colors
var $colors = $(colors);
var selectedColor = '';
var resetThemeClass = function () {
$colors.find('.cp-palette-color').each(function (i, el) {
var $c = $(el);
@ -438,7 +437,7 @@ define([
$modal.find('nav button.danger').prop('disabled', unlocked ? '' : 'disabled');
offline = !unlocked;
palette.disable(offline);
colors.disable(offline);
});