nodebb-theme-harmony 0.0.12 → 0.0.13
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/library.js
CHANGED
|
@@ -12,6 +12,7 @@ const defaults = {
|
|
|
12
12
|
enableQuickReply: 'on',
|
|
13
13
|
centerHeaderElements: 'off',
|
|
14
14
|
stickyToolbar: 'on',
|
|
15
|
+
openSidebars: 'off',
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
library.init = async function (params) {
|
|
@@ -99,6 +100,7 @@ library.getThemeConfig = async function (config) {
|
|
|
99
100
|
config.enableQuickReply = themeConfig.enableQuickReply === 'on';
|
|
100
101
|
config.centerHeaderElements = themeConfig.centerHeaderElements === 'on';
|
|
101
102
|
config.stickyToolbar = themeConfig.stickyToolbar === 'on';
|
|
103
|
+
config.openSidebars = themeConfig.openSidebars === 'on';
|
|
102
104
|
config.openDraftsOnPageLoad = false;
|
|
103
105
|
return config;
|
|
104
106
|
};
|
|
@@ -115,7 +117,9 @@ library.getAdminSettings = async function (hookData) {
|
|
|
115
117
|
|
|
116
118
|
library.saveUserSettings = async function (hookData) {
|
|
117
119
|
Object.keys(defaults).forEach((key) => {
|
|
118
|
-
|
|
120
|
+
if (hookData.data.hasOwnProperty(key)) {
|
|
121
|
+
hookData.settings[key] = hookData.data[key] || undefined;
|
|
122
|
+
}
|
|
119
123
|
});
|
|
120
124
|
return hookData;
|
|
121
125
|
};
|
package/package.json
CHANGED
package/public/harmony.js
CHANGED
|
@@ -35,9 +35,19 @@ $(document).ready(function () {
|
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
function setupMobileMenu() {
|
|
38
|
-
|
|
39
|
-
$('
|
|
40
|
-
|
|
38
|
+
require(['api'], function (api) {
|
|
39
|
+
$('[component="sidebar/toggle"]').on('click', async function () {
|
|
40
|
+
const sidebarEl = $('.sidebar');
|
|
41
|
+
sidebarEl.toggleClass('open');
|
|
42
|
+
if (app.user.uid) {
|
|
43
|
+
await api.put(`/users/${app.user.uid}/settings`, {
|
|
44
|
+
settings: {
|
|
45
|
+
openSidebars: sidebarEl.hasClass('open') ? 'on' : 'off',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
$(window).trigger('action:sidebar.toggle');
|
|
50
|
+
});
|
|
41
51
|
});
|
|
42
52
|
}
|
|
43
53
|
|
|
@@ -79,7 +89,6 @@ $(document).ready(function () {
|
|
|
79
89
|
draftListEl.children(':not(.no-drafts)').remove();
|
|
80
90
|
|
|
81
91
|
const draftItems = drafts.listAvailable();
|
|
82
|
-
console.log('harmony sees', draftItems);
|
|
83
92
|
if (!draftItems.length) {
|
|
84
93
|
draftListEl.find('.no-drafts').removeClass('hidden');
|
|
85
94
|
return;
|
|
@@ -89,7 +98,7 @@ $(document).ready(function () {
|
|
|
89
98
|
draft.text = draft.text.replace(/(?:\r\n|\r|\n)/g, '<br>');
|
|
90
99
|
}
|
|
91
100
|
});
|
|
92
|
-
|
|
101
|
+
|
|
93
102
|
const html = await app.parseAndTranslate('partials/sidebar/drafts', 'drafts', { drafts: draftItems });
|
|
94
103
|
draftListEl.find('.no-drafts').addClass('hidden');
|
|
95
104
|
draftListEl.append(html).find('.timeago').timeago();
|
|
@@ -34,6 +34,11 @@
|
|
|
34
34
|
</div>
|
|
35
35
|
|
|
36
36
|
<div class="d-flex flex-column flex-md-row">
|
|
37
|
+
<div data-widget-area="left">
|
|
38
|
+
{{{each widgets.left}}}
|
|
39
|
+
{{widgets.left.html}}
|
|
40
|
+
{{{end}}}
|
|
41
|
+
</div>
|
|
37
42
|
<!-- IMPORT partials/groups/sidebar-left.tpl -->
|
|
38
43
|
|
|
39
44
|
<div class="flex-1 ps-md-2 ps-lg-5" style="min-width:0;">
|
|
@@ -68,5 +73,11 @@
|
|
|
68
73
|
{{{ end }}}
|
|
69
74
|
</div>
|
|
70
75
|
</div>
|
|
76
|
+
|
|
77
|
+
<div data-widget-area="right">
|
|
78
|
+
{{{each widgets.right}}}
|
|
79
|
+
{{widgets.right.html}}
|
|
80
|
+
{{{end}}}
|
|
81
|
+
</div>
|
|
71
82
|
</div>
|
|
72
83
|
</div>
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
{{{ end }}}
|
|
43
43
|
|
|
44
44
|
{{{if !posts.length}}}
|
|
45
|
-
<div class="text-center no-results">[[search:no-matches]]</li>
|
|
45
|
+
<div class="text-center no-results py-2 py-md-0">[[search:no-matches]]</li>
|
|
46
46
|
<li role="separator" class="dropdown-divider d-block d-md-none"></li>
|
|
47
47
|
{{{end}}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<nav class="text-dark bg-light sidebar sidebar-left start-0 border-end vh-100 d-none d-md-flex flex-column justify-content-between sticky-top ff-secondary">
|
|
1
|
+
<nav class="{{{ if config.openSidebars}}}open{{{ end }}} text-dark bg-light sidebar sidebar-left start-0 border-end vh-100 d-none d-md-flex flex-column justify-content-between sticky-top ff-secondary">
|
|
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 function.displayMenuItem, @index -->
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<nav class="text-dark bg-light sidebar sidebar-right end-0 border-start vh-100 d-none d-md-flex flex-column sticky-top ff-secondary">
|
|
1
|
+
<nav class="{{{ if config.openSidebars}}}open{{{ end }}} text-dark bg-light sidebar sidebar-right end-0 border-start vh-100 d-none d-md-flex flex-column sticky-top ff-secondary">
|
|
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 -->
|