mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 13:57:24 +02:00
feat: bring back noskin option
if forum sets a default skin there was no way for the user to go back to the no skin version
This commit is contained in:
@@ -155,6 +155,8 @@
|
||||
"no-group-title": "No group title",
|
||||
|
||||
"select-skin": "Select a Skin",
|
||||
"default": "Default (%1)",
|
||||
"no-skin": "No Skin",
|
||||
|
||||
"select-homepage": "Select a Homepage",
|
||||
"homepage": "Homepage",
|
||||
|
||||
@@ -108,6 +108,8 @@ get:
|
||||
type: boolean
|
||||
bootswatchSkin:
|
||||
type: string
|
||||
defaultBootswatchSkin:
|
||||
type: string
|
||||
composer:showHelpTab:
|
||||
type: boolean
|
||||
enablePostHistory:
|
||||
|
||||
@@ -5,15 +5,19 @@ define('forum/account/settings', [
|
||||
'forum/account/header', 'components', 'api', 'alerts', 'hooks',
|
||||
], function (header, components, api, alerts, hooks) {
|
||||
const AccountSettings = {};
|
||||
|
||||
let savedSkin = '';
|
||||
// If page skin is changed but not saved, switch the skin back
|
||||
$(window).on('action:ajaxify.start', function () {
|
||||
if (ajaxify.data.template.name === 'account/settings' && $('#bootswatchSkin').length && $('#bootswatchSkin').val() !== config.bootswatchSkin) {
|
||||
reskin(config.bootswatchSkin);
|
||||
const skinEl = $('#bootswatchSkin');
|
||||
if (
|
||||
ajaxify.data.template.name === 'account/settings' &&
|
||||
skinEl.length && skinEl.val() !== savedSkin) {
|
||||
reskin(savedSkin);
|
||||
}
|
||||
});
|
||||
|
||||
AccountSettings.init = function () {
|
||||
savedSkin = $('#bootswatchSkin').length && $('#bootswatchSkin').val();
|
||||
header.init();
|
||||
|
||||
$('#submitBtn').on('click', function () {
|
||||
@@ -76,7 +80,10 @@ define('forum/account/settings', [
|
||||
if (key === 'userLang' && config.userLang !== newSettings.userLang) {
|
||||
languageChanged = true;
|
||||
}
|
||||
if (config.hasOwnProperty(key)) {
|
||||
if (key === 'bootswatchSkin') {
|
||||
savedSkin = newSettings.bootswatchSkin;
|
||||
config.bootswatchSkin = savedSkin === 'noskin' ? '' : savedSkin;
|
||||
} else if (config.hasOwnProperty(key)) {
|
||||
config[key] = newSettings[key];
|
||||
}
|
||||
}
|
||||
@@ -105,6 +112,12 @@ define('forum/account/settings', [
|
||||
return;
|
||||
}
|
||||
|
||||
if (skinName === '') {
|
||||
skinName = config.defaultBootswatchSkin || '';
|
||||
} else if (skinName === 'noskin') {
|
||||
skinName = '';
|
||||
}
|
||||
|
||||
const currentSkinClassName = $('body').attr('class').split(/\s+/).filter(function (className) {
|
||||
return className.startsWith('skin-');
|
||||
});
|
||||
@@ -143,7 +156,8 @@ define('forum/account/settings', [
|
||||
if (app.user.uid) {
|
||||
await api.put(`/users/${app.user.uid}/settings`, { settings: { bootswatchSkin: skin } });
|
||||
}
|
||||
config.bootswatchSkin = skin;
|
||||
config.bootswatchSkin = skin === 'noskin' ? '' : skin;
|
||||
savedSkin = skin;
|
||||
reskin(skin);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user