nodebb-theme-harmony 1.0.40 → 1.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/controllers.js
CHANGED
|
@@ -14,9 +14,14 @@ Controllers.renderThemeSettings = async (req, res, next) => {
|
|
|
14
14
|
if (!userData) {
|
|
15
15
|
return next();
|
|
16
16
|
}
|
|
17
|
+
const lib = require('../library');
|
|
18
|
+
userData.theme = await lib.loadThemeConfig(userData.uid);
|
|
17
19
|
|
|
18
20
|
userData.title = '[[themes/harmony:settings.title]]';
|
|
19
|
-
userData.breadcrumbs = helpers.buildBreadcrumbs([
|
|
21
|
+
userData.breadcrumbs = helpers.buildBreadcrumbs([
|
|
22
|
+
{ text: userData.username, url: `/user/${userData.userslug}` },
|
|
23
|
+
{ text: '[[themes/harmony:settings.title]]' },
|
|
24
|
+
]);
|
|
20
25
|
|
|
21
26
|
res.render('account/theme', userData);
|
|
22
27
|
};
|
package/library.js
CHANGED
|
@@ -134,7 +134,7 @@ library.defineWidgetAreas = async function (areas) {
|
|
|
134
134
|
return areas;
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
async function
|
|
137
|
+
library.loadThemeConfig = async function (uid) {
|
|
138
138
|
const [themeConfig, userConfig] = await Promise.all([
|
|
139
139
|
meta.settings.get('harmony'),
|
|
140
140
|
user.getSettings(uid),
|
|
@@ -149,10 +149,10 @@ async function loadThemeConfig(uid) {
|
|
|
149
149
|
config.openSidebars = config.openSidebars === 'on';
|
|
150
150
|
config.chatModals = config.chatModals === 'on';
|
|
151
151
|
return config;
|
|
152
|
-
}
|
|
152
|
+
};
|
|
153
153
|
|
|
154
154
|
library.getThemeConfig = async function (config) {
|
|
155
|
-
config.theme = await loadThemeConfig(config.uid);
|
|
155
|
+
config.theme = await library.loadThemeConfig(config.uid);
|
|
156
156
|
config.openDraftsOnPageLoad = false;
|
|
157
157
|
return config;
|
|
158
158
|
};
|
package/package.json
CHANGED
package/public/settings.js
CHANGED
|
@@ -14,12 +14,14 @@ define('forum/account/theme', ['forum/account/header', 'api', 'settings', 'alert
|
|
|
14
14
|
const formEl = document.getElementById('theme-settings');
|
|
15
15
|
saveEl.addEventListener('click', async () => {
|
|
16
16
|
const themeSettings = settings.helper.serializeForm($(formEl));
|
|
17
|
-
await api.put(`/users/${
|
|
17
|
+
await api.put(`/users/${ajaxify.data.uid}/settings`, {
|
|
18
18
|
settings: {
|
|
19
19
|
...themeSettings,
|
|
20
20
|
},
|
|
21
21
|
});
|
|
22
|
-
|
|
22
|
+
if (ajaxify.data.isSelf) {
|
|
23
|
+
config.theme = (await api.get('/api/config')).theme;
|
|
24
|
+
}
|
|
23
25
|
alerts.success('[[success:settings-saved]]');
|
|
24
26
|
});
|
|
25
27
|
}
|
|
@@ -8,22 +8,22 @@
|
|
|
8
8
|
|
|
9
9
|
<form id="theme-settings" role="form">
|
|
10
10
|
<div class="form-check mb-3">
|
|
11
|
-
<input class="form-check-input" type="checkbox" id="enableQuickReply" name="enableQuickReply" {{{ if
|
|
11
|
+
<input class="form-check-input" type="checkbox" id="enableQuickReply" name="enableQuickReply" {{{ if theme.enableQuickReply }}}checked{{{ end }}}>
|
|
12
12
|
<label class="form-check-label" for="enableQuickReply">[[themes/harmony:settings.enableQuickReply]]</label>
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
15
|
<div class="form-check mb-3">
|
|
16
|
-
<input class="form-check-input" type="checkbox" id="centerHeaderElements" name="centerHeaderElements" {{{ if
|
|
16
|
+
<input class="form-check-input" type="checkbox" id="centerHeaderElements" name="centerHeaderElements" {{{ if theme.centerHeaderElements }}}checked{{{ end }}}>
|
|
17
17
|
<label class="form-check-label" for="centerHeaderElements">[[themes/harmony:settings.centerHeaderElements]]</label>
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
20
|
<div class="form-check mb-3">
|
|
21
|
-
<input class="form-check-input" type="checkbox" id="mobileTopicTeasers" name="mobileTopicTeasers" {{{ if
|
|
21
|
+
<input class="form-check-input" type="checkbox" id="mobileTopicTeasers" name="mobileTopicTeasers" {{{ if theme.mobileTopicTeasers }}}checked{{{ end }}}>
|
|
22
22
|
<label class="form-check-label" for="mobileTopicTeasers">[[themes/harmony:settings.mobileTopicTeasers]]</label>
|
|
23
23
|
</div>
|
|
24
24
|
|
|
25
25
|
<div class="form-check mb-3">
|
|
26
|
-
<input class="form-check-input" type="checkbox" id="stickyToolbar" name="stickyToolbar" {{{ if
|
|
26
|
+
<input class="form-check-input" type="checkbox" id="stickyToolbar" name="stickyToolbar" {{{ if theme.stickyToolbar }}}checked{{{ end }}}>
|
|
27
27
|
<label class="form-check-label" for="stickyToolbar">
|
|
28
28
|
[[themes/harmony:settings.stickyToolbar]]
|
|
29
29
|
<p class="form-text mb-0">
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
</div>
|
|
34
34
|
|
|
35
35
|
<div class="form-check mb-3">
|
|
36
|
-
<input class="form-check-input" type="checkbox" id="autohideBottombar" name="autohideBottombar" {{{ if
|
|
36
|
+
<input class="form-check-input" type="checkbox" id="autohideBottombar" name="autohideBottombar" {{{ if theme.autohideBottombar }}}checked{{{ end }}}>
|
|
37
37
|
<label class="form-check-label" for="autohideBottombar">
|
|
38
38
|
[[themes/harmony:settings.autohideBottombar]]
|
|
39
39
|
<p class="form-text mb-0">
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
<div class="form-check mb-3">
|
|
46
|
-
<input class="form-check-input" type="checkbox" id="chatModals" name="chatModals" {{{ if
|
|
46
|
+
<input class="form-check-input" type="checkbox" id="chatModals" name="chatModals" {{{ if theme.chatModals }}}checked{{{ end }}}>
|
|
47
47
|
<label class="form-check-label" for="chatModals">
|
|
48
48
|
[[themes/harmony:settings.chatModals]]
|
|
49
49
|
</label>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<nav class="{{{ if config.theme.openSidebars}}}open{{{ end }}} text-dark bg-light sidebar sidebar-left start-0 border-end vh-100 d-none d-lg-flex flex-column justify-content-between sticky-top">
|
|
1
|
+
<nav component="sidebar/left" class="{{{ if config.theme.openSidebars}}}open{{{ end }}} text-dark bg-light sidebar sidebar-left start-0 border-end vh-100 d-none d-lg-flex flex-column justify-content-between sticky-top">
|
|
2
2
|
<ul id="main-nav" class="list-unstyled d-flex flex-column w-100 gap-2 mt-2">
|
|
3
3
|
{{{ each navigation }}}
|
|
4
4
|
{{{ if displayMenuItem(@root, @index) }}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<nav class="{{{ if config.theme.openSidebars}}}open{{{ end }}} text-dark bg-light sidebar sidebar-right end-0 border-start vh-100 d-none d-lg-flex flex-column sticky-top">
|
|
1
|
+
<nav component="sidebar/right" class="{{{ if config.theme.openSidebars}}}open{{{ end }}} text-dark bg-light sidebar sidebar-right end-0 border-start vh-100 d-none d-lg-flex flex-column sticky-top">
|
|
2
2
|
{{{ if config.loggedIn }}}
|
|
3
3
|
<ul id="logged-in-menu" class="list-unstyled d-flex flex-column w-100 gap-2 mt-2">
|
|
4
4
|
<!-- IMPORT partials/sidebar/logged-in-menu.tpl -->
|