nodebb-theme-harmony 0.0.12 → 0.0.14
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 +5 -1
- package/package.json +1 -1
- package/public/harmony.js +14 -5
- package/scss/mixins.scss +1 -1
- package/scss/modules/topic-navigator.scss +4 -0
- package/templates/groups/details.tpl +11 -0
- package/templates/partials/quick-search-results.tpl +1 -1
- package/templates/partials/sidebar-left.tpl +1 -1
- package/templates/partials/sidebar-right.tpl +1 -1
- package/templates/partials/topic/navigator.tpl +1 -1
- package/templates/partials/topic/post.tpl +2 -2
- package/templates/partials/topic/reply-button.tpl +1 -1
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();
|
package/scss/mixins.scss
CHANGED
|
@@ -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 -->
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div class="d-
|
|
1
|
+
<div class="d-sm-flex flex-column flex-grow-1 align-items-center mb-2 mx-2 mt-auto" component="topic/navigator">
|
|
2
2
|
<a href="#" class="nav-link border-0 p-2" data-action="toTop"><i class="fa fa-fw fa-angles-up"></i></a>
|
|
3
3
|
<a href="#" class="nav-link border-0 p-2" data-action="scrollUp"><i class="fa fa-fw fa-angle-up"></i></a>
|
|
4
4
|
<div class="track d-inline-block flex-grow-1 position-relative">
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
|
|
72
72
|
<div class="clearfix">
|
|
73
73
|
{{{ if !hideReplies }}}
|
|
74
|
-
<a component="post/reply-count" data-target-component="post/replies/container" href="#" class="d-flex gap-2 align-items-center mt-2 border rounded-1 p-1 threaded-replies user-select-none float-start text-muted text-decoration-none {{{ if !posts.replies.count }}}hidden{{{ end }}}">
|
|
74
|
+
<a component="post/reply-count" data-target-component="post/replies/container" href="#" class="d-flex gap-2 align-items-center mt-2 btn-outline border rounded-1 p-1 threaded-replies user-select-none float-start text-muted text-decoration-none {{{ if !posts.replies.count }}}hidden{{{ end }}}">
|
|
75
75
|
<span component="post/reply-count/avatars" class="avatars d-inline-flex gap-1 align-items-top {{{ if posts.replies.hasMore }}}hasMore{{{ end }}}">
|
|
76
76
|
{{{each posts.replies.users}}}
|
|
77
77
|
<span>{buildAvatar(posts.replies.users, "20px", true, "")}</span>
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
{{{ end }}}
|
|
92
92
|
</div>
|
|
93
93
|
|
|
94
|
-
<div component="post/replies/container" class="
|
|
94
|
+
<div component="post/replies/container" class="my-2 col-11 border rounded-1 p-3"></div>
|
|
95
95
|
|
|
96
96
|
<div component="post/actions" class="d-flex justify-content-end gap-1 post-tools">
|
|
97
97
|
<!-- IMPORT partials/topic/reactions.tpl -->
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div component="topic/reply/container" class="btn-group action-bar bottom-sheet {{{ if !privileges.topics:reply }}}hidden{{{ end }}}">
|
|
2
|
-
<a href="{config.relative_path}/compose?tid={tid}&title={title}" class="d-flex align-items-center btn btn-sm btn-primary px-3 fw-semibold " component="topic/reply" data-ajaxify="false" role="button"><i class="fa fa-reply
|
|
2
|
+
<a href="{config.relative_path}/compose?tid={tid}&title={title}" class="d-flex align-items-center btn btn-sm btn-primary px-3 fw-semibold " component="topic/reply" data-ajaxify="false" role="button"><i class="fa fa-reply d-sm-block d-md-none"></i><span class="d-none d-md-block"> [[topic:reply]]</span></a>
|
|
3
3
|
<button type="button" class="btn btn-sm btn-primary dropdown-toggle" data-bs-toggle="dropdown">
|
|
4
4
|
<span class="caret"></span>
|
|
5
5
|
</button>
|