Merge branch 'staging' into communities-trim

This commit is contained in:
yflory
2020-02-11 11:10:12 +01:00
47 changed files with 1525 additions and 1280 deletions

View File

@@ -17,6 +17,10 @@
flex-flow: column;
font: @colortheme_app-font;
.cp-sidebarlayout-element {
max-width: 650px;
}
#cp-export-container {
font-size: 16px;
display: flex;
@@ -121,8 +125,13 @@
border: 1px solid black;
}
.cp-settings-language-selector {
#cp-language-selector {
display: inline;
}
button.btn {
width: @sidebar_button-width;
max-width: 100%;
margin: 0 !important;
background-color: @colortheme_sidebar-button-alt-bg;
border-color: #adadad;
color: black;
@@ -149,6 +158,7 @@
.cp-settings-info-block {
[type="text"] {
width: @sidebar_button-width;
max-width: 100%;
}
}

View File

@@ -56,7 +56,7 @@ define([
'cp-settings-migrate',
'cp-settings-delete'
],
'security': [ // XXX
'security': [
'cp-settings-logout-everywhere',
'cp-settings-autostore',
'cp-settings-safe-links',
@@ -118,6 +118,18 @@ define([
var create = {};
var SPECIAL_HINTS_HANDLER = {
safeLinks: function () {
return $('<span>', {'class': 'cp-sidebarlayout-description'})
.html(Messages._getKey('settings_safeLinksHint', ['<span class="fa fa-shhare-alt"></span>']));
},
};
var DEFAULT_HINT_HANDLER = function (safeKey) {
return $('<span>', {'class': 'cp-sidebarlayout-description'})
.text(Messages['settings_'+safeKey+'Hint'] || 'Coming soon...');
};
var makeBlock = function (key, getter, full) {
var safeKey = key.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
@@ -125,8 +137,14 @@ define([
var $div = $('<div>', {'class': 'cp-settings-' + key + ' cp-sidebarlayout-element'});
if (full) {
$('<label>').text(Messages['settings_'+safeKey+'Title'] || key).appendTo($div);
$('<span>', {'class': 'cp-sidebarlayout-description'})
.text(Messages['settings_'+safeKey+'Hint'] || 'Coming soon...').appendTo($div);
// if this block's hint needs a special renderer, then create it in SPECIAL_HINTS_HANLDER
// otherwise the default will be used
var hintFunction = (typeof(SPECIAL_HINTS_HANDLER[safeKey]) === 'function')?
SPECIAL_HINTS_HANDLER[safeKey]:
DEFAULT_HINT_HANDLER;
hintFunction(safeKey).appendTo($div);
}
getter(function (content) {
$div.append(content);
@@ -571,14 +589,14 @@ define([
// Security
makeBlock('safe-links', function (cb) {
// XXX settings_safeLinksTitle, settings_safeLinksHint, settings_safeLinksCheckbox
var $cbox = $(UI.createCheckbox('cp-settings-safe-links',
Messages.settings_safeLinksCheckbox,
true, { label: {class: 'noTitle'} }));
false, { label: {class: 'noTitle'} }));
var spinner = UI.makeSpinner($cbox);
// Checkbox: "Enable safe links"
var $checkbox = $cbox.find('input').on('change', function () {
spinner.spin();
var val = !$checkbox.is(':checked');
@@ -589,7 +607,7 @@ define([
common.getAttribute(['security', 'unsafeLinks'], function (e, val) {
if (e) { return void console.error(e); }
if (!val) {
if (val === false) {
$checkbox.attr('checked', 'checked');
}
});