nodebb-theme-harmony 2.0.1 → 2.0.3

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.
Files changed (144) hide show
  1. package/.eslintrc +3 -3
  2. package/README.md +22 -22
  3. package/lib/controllers.js +29 -29
  4. package/library.js +183 -183
  5. package/package.json +48 -48
  6. package/plugin.json +24 -24
  7. package/public/.eslintrc +3 -3
  8. package/public/admin.js +15 -15
  9. package/public/harmony.js +287 -287
  10. package/public/settings.js +31 -31
  11. package/renovate.json +6 -6
  12. package/scss/account.scss +27 -27
  13. package/scss/category.scss +3 -3
  14. package/scss/chats.scss +11 -11
  15. package/scss/common.scss +122 -122
  16. package/scss/fonts.scss +19 -19
  17. package/scss/groups.scss +22 -22
  18. package/scss/harmony.scss +24 -24
  19. package/scss/header.scss +15 -15
  20. package/scss/mixins.scss +183 -183
  21. package/scss/modals.scss +6 -6
  22. package/scss/modules/breadcrumbs.scss +15 -15
  23. package/scss/modules/cover.scss +102 -102
  24. package/scss/modules/filters.scss +7 -7
  25. package/scss/modules/nprogress.scss +80 -80
  26. package/scss/modules/paginator.scss +23 -23
  27. package/scss/modules/tags.scss +5 -5
  28. package/scss/modules/topic-navigator.scss +52 -52
  29. package/scss/modules/topics-list.scss +40 -40
  30. package/scss/modules/user-menu.scss +10 -10
  31. package/scss/overrides.scss +65 -65
  32. package/scss/sidebar.scss +188 -188
  33. package/scss/skins.scss +58 -58
  34. package/scss/status.scss +24 -24
  35. package/scss/topic.scss +130 -130
  36. package/templates/account/blocks.tpl +51 -51
  37. package/templates/account/categories.tpl +63 -63
  38. package/templates/account/consent.tpl +73 -73
  39. package/templates/account/edit/password.tpl +34 -34
  40. package/templates/account/edit/username.tpl +29 -29
  41. package/templates/account/edit.tpl +137 -137
  42. package/templates/account/followers.tpl +14 -14
  43. package/templates/account/following.tpl +15 -15
  44. package/templates/account/groups.tpl +15 -15
  45. package/templates/account/info.tpl +270 -270
  46. package/templates/account/posts.tpl +35 -35
  47. package/templates/account/profile.tpl +92 -92
  48. package/templates/account/sessions.tpl +8 -8
  49. package/templates/account/settings.tpl +236 -236
  50. package/templates/account/shares.tpl +19 -19
  51. package/templates/account/tags.tpl +12 -12
  52. package/templates/account/theme.tpl +63 -63
  53. package/templates/account/topics.tpl +44 -44
  54. package/templates/account/uploads.tpl +37 -37
  55. package/templates/admin/plugins/harmony.tpl +57 -57
  56. package/templates/categories.tpl +29 -29
  57. package/templates/category.tpl +72 -72
  58. package/templates/footer.tpl +17 -17
  59. package/templates/groups/details.tpl +86 -86
  60. package/templates/groups/list.tpl +58 -58
  61. package/templates/groups/members.tpl +9 -9
  62. package/templates/header.tpl +45 -45
  63. package/templates/notifications.tpl +32 -32
  64. package/templates/partials/account/admin-menu.tpl +36 -36
  65. package/templates/partials/account/category-item.tpl +22 -22
  66. package/templates/partials/account/footer.tpl +2 -2
  67. package/templates/partials/account/header.tpl +98 -98
  68. package/templates/partials/account/session-list.tpl +18 -18
  69. package/templates/partials/account/sidebar-left.tpl +116 -116
  70. package/templates/partials/breadcrumbs-json-ld.tpl +15 -15
  71. package/templates/partials/breadcrumbs.tpl +12 -12
  72. package/templates/partials/buttons/newTopic.tpl +22 -22
  73. package/templates/partials/categories/item.tpl +56 -56
  74. package/templates/partials/categories/lastpost.tpl +24 -24
  75. package/templates/partials/categories/link.tpl +4 -4
  76. package/templates/partials/category/subcategory.tpl +18 -18
  77. package/templates/partials/category/tags.tpl +3 -3
  78. package/templates/partials/cookie-consent.tpl +6 -6
  79. package/templates/partials/groups/admin.tpl +95 -95
  80. package/templates/partials/groups/invited.tpl +32 -32
  81. package/templates/partials/groups/list.tpl +15 -15
  82. package/templates/partials/groups/memberlist.tpl +46 -46
  83. package/templates/partials/groups/pending.tpl +29 -29
  84. package/templates/partials/groups/sidebar-left.tpl +27 -27
  85. package/templates/partials/header/brand.tpl +27 -27
  86. package/templates/partials/mobile-footer.tpl +95 -95
  87. package/templates/partials/notifications_list.tpl +44 -44
  88. package/templates/partials/paginator.tpl +46 -46
  89. package/templates/partials/post_bar.tpl +27 -27
  90. package/templates/partials/posts_list.tpl +7 -7
  91. package/templates/partials/posts_list_item.tpl +19 -19
  92. package/templates/partials/quick-search-results.tpl +46 -46
  93. package/templates/partials/search-filters.tpl +183 -183
  94. package/templates/partials/search-results.tpl +54 -54
  95. package/templates/partials/sidebar/chats.tpl +45 -45
  96. package/templates/partials/sidebar/drafts.tpl +63 -63
  97. package/templates/partials/sidebar/logged-in-menu.tpl +22 -22
  98. package/templates/partials/sidebar/logged-out-menu.tpl +44 -44
  99. package/templates/partials/sidebar/notifications.tpl +49 -49
  100. package/templates/partials/sidebar/search-mobile.tpl +28 -28
  101. package/templates/partials/sidebar/search.tpl +30 -30
  102. package/templates/partials/sidebar/user-menu.tpl +103 -103
  103. package/templates/partials/sidebar-left.tpl +39 -39
  104. package/templates/partials/sidebar-right.tpl +16 -16
  105. package/templates/partials/skin-switcher.tpl +50 -50
  106. package/templates/partials/tags_list.tpl +7 -7
  107. package/templates/partials/toast.tpl +19 -19
  108. package/templates/partials/topic/event.tpl +12 -12
  109. package/templates/partials/topic/navigation-post.tpl +9 -9
  110. package/templates/partials/topic/navigator-mobile.tpl +61 -61
  111. package/templates/partials/topic/navigator.tpl +26 -26
  112. package/templates/partials/topic/necro-post.tpl +5 -5
  113. package/templates/partials/topic/post-menu-list.tpl +156 -156
  114. package/templates/partials/topic/post-menu.tpl +4 -4
  115. package/templates/partials/topic/post-placeholder.tpl +14 -14
  116. package/templates/partials/topic/post.tpl +146 -146
  117. package/templates/partials/topic/quickreply.tpl +28 -28
  118. package/templates/partials/topic/reply-button.tpl +26 -26
  119. package/templates/partials/topic/selection-tooltip.tpl +2 -2
  120. package/templates/partials/topic/sort.tpl +27 -27
  121. package/templates/partials/topic/stats.tpl +14 -14
  122. package/templates/partials/topic/thumbs.tpl +4 -4
  123. package/templates/partials/topic/tools.tpl +8 -8
  124. package/templates/partials/topic/topic-menu-list.tpl +73 -73
  125. package/templates/partials/topic/watch.tpl +59 -59
  126. package/templates/partials/topic-filters.tpl +15 -15
  127. package/templates/partials/topic-list-bar.tpl +54 -54
  128. package/templates/partials/topic-terms.tpl +15 -15
  129. package/templates/partials/topics_list.tpl +131 -131
  130. package/templates/partials/users/item.tpl +39 -39
  131. package/templates/partials/users_list.tpl +4 -4
  132. package/templates/partials/users_list_menu.tpl +14 -14
  133. package/templates/popular.tpl +34 -34
  134. package/templates/post-queue.tpl +211 -211
  135. package/templates/recent.tpl +42 -42
  136. package/templates/search.tpl +46 -46
  137. package/templates/tag.tpl +34 -34
  138. package/templates/tags.tpl +49 -49
  139. package/templates/top.tpl +34 -34
  140. package/templates/topic.tpl +123 -123
  141. package/templates/unread.tpl +31 -31
  142. package/templates/users.tpl +39 -39
  143. package/templates/world.tpl +66 -66
  144. package/theme.json +6 -6
package/.eslintrc CHANGED
@@ -1,3 +1,3 @@
1
- {
2
- "extends": "nodebb"
3
- }
1
+ {
2
+ "extends": "nodebb"
3
+ }
package/README.md CHANGED
@@ -1,22 +1,22 @@
1
- Harmony theme for NodeBB
2
- ====================
3
-
4
- The Harmony theme is the default theme for NodeBB for versions spanning v3.0.0 onwards.
5
-
6
- ## Issues
7
-
8
- Issues are tracked in [the main project issue tracker](https://github.com/NodeBB/NodeBB/issues?q=is%3Aopen+is%3Aissue+label%3Athemes).
9
-
10
- ## Screenshots
11
-
12
- ### Categories
13
-
14
- _The cards in the header are added by the recent cards plugin. https://github.com/NodeBB-Community/nodebb-plugin-recent-cards_
15
-
16
- <img height="450" src="screenshots/categories.png">
17
-
18
- ### Recent
19
- <img height="450" src="screenshots/recent.png">
20
-
21
- ### Topic
22
- <img height="450" src="screenshots/topic.png">
1
+ Harmony theme for NodeBB
2
+ ====================
3
+
4
+ The Harmony theme is the default theme for NodeBB for versions spanning v3.0.0 onwards.
5
+
6
+ ## Issues
7
+
8
+ Issues are tracked in [the main project issue tracker](https://github.com/NodeBB/NodeBB/issues?q=is%3Aopen+is%3Aissue+label%3Athemes).
9
+
10
+ ## Screenshots
11
+
12
+ ### Categories
13
+
14
+ _The cards in the header are added by the recent cards plugin. https://github.com/NodeBB-Community/nodebb-plugin-recent-cards_
15
+
16
+ <img height="450" src="screenshots/categories.png">
17
+
18
+ ### Recent
19
+ <img height="450" src="screenshots/recent.png">
20
+
21
+ ### Topic
22
+ <img height="450" src="screenshots/topic.png">
@@ -1,29 +1,29 @@
1
- 'use strict';
2
-
3
- const Controllers = module.exports;
4
-
5
- const accountHelpers = require.main.require('./src/controllers/accounts/helpers');
6
- const helpers = require.main.require('./src/controllers/helpers');
7
-
8
- Controllers.renderAdminPage = (req, res) => {
9
- res.render('admin/plugins/harmony', {
10
- title: '[[themes/harmony:theme-name]]',
11
- });
12
- };
13
-
14
- Controllers.renderThemeSettings = async (req, res, next) => {
15
- const userData = await accountHelpers.getUserDataByUserSlug(req.params.userslug, req.uid, req.query);
16
- if (!userData) {
17
- return next();
18
- }
19
- const lib = require('../library');
20
- userData.theme = await lib.loadThemeConfig(userData.uid);
21
-
22
- userData.title = '[[themes/harmony:settings.title]]';
23
- userData.breadcrumbs = helpers.buildBreadcrumbs([
24
- { text: userData.username, url: `/user/${userData.userslug}` },
25
- { text: '[[themes/harmony:settings.title]]' },
26
- ]);
27
-
28
- res.render('account/theme', userData);
29
- };
1
+ 'use strict';
2
+
3
+ const Controllers = module.exports;
4
+
5
+ const accountHelpers = require.main.require('./src/controllers/accounts/helpers');
6
+ const helpers = require.main.require('./src/controllers/helpers');
7
+
8
+ Controllers.renderAdminPage = (req, res) => {
9
+ res.render('admin/plugins/harmony', {
10
+ title: '[[themes/harmony:theme-name]]',
11
+ });
12
+ };
13
+
14
+ Controllers.renderThemeSettings = async (req, res, next) => {
15
+ const userData = await accountHelpers.getUserDataByUserSlug(req.params.userslug, req.uid, req.query);
16
+ if (!userData) {
17
+ return next();
18
+ }
19
+ const lib = require('../library');
20
+ userData.theme = await lib.loadThemeConfig(userData.uid);
21
+
22
+ userData.title = '[[themes/harmony:settings.title]]';
23
+ userData.breadcrumbs = helpers.buildBreadcrumbs([
24
+ { text: userData.username, url: `/user/${userData.userslug}` },
25
+ { text: '[[themes/harmony:settings.title]]' },
26
+ ]);
27
+
28
+ res.render('account/theme', userData);
29
+ };
package/library.js CHANGED
@@ -1,184 +1,184 @@
1
- 'use strict';
2
-
3
- const nconf = require.main.require('nconf');
4
- const meta = require.main.require('./src/meta');
5
- const _ = require.main.require('lodash');
6
- const user = require.main.require('./src/user');
7
-
8
- const controllers = require('./lib/controllers');
9
-
10
- const library = module.exports;
11
-
12
- const defaults = {
13
- enableQuickReply: 'on',
14
- enableBreadcrumbs: 'on',
15
- centerHeaderElements: 'off',
16
- mobileTopicTeasers: 'off',
17
- stickyToolbar: 'on',
18
- autohideBottombar: 'on',
19
- openSidebars: 'off',
20
- chatModals: 'off',
21
- };
22
-
23
- library.init = async function (params) {
24
- const { router, middleware } = params;
25
- const routeHelpers = require.main.require('./src/routes/helpers');
26
-
27
- routeHelpers.setupAdminPageRoute(router, '/admin/plugins/harmony', [], controllers.renderAdminPage);
28
-
29
- routeHelpers.setupPageRoute(router, '/user/:userslug/theme', [
30
- middleware.exposeUid,
31
- middleware.ensureLoggedIn,
32
- middleware.canViewUsers,
33
- middleware.checkAccountPermissions,
34
- ], controllers.renderThemeSettings);
35
-
36
- if (nconf.get('isPrimary') && process.env.NODE_ENV === 'production') {
37
- setTimeout(buildSkins, 0);
38
- }
39
- };
40
-
41
- async function buildSkins() {
42
- try {
43
- const plugins = require.main.require('./src/plugins');
44
- await plugins.prepareForBuild(['client side styles']);
45
- for (const skin of meta.css.supportedSkins) {
46
- // eslint-disable-next-line no-await-in-loop
47
- await meta.css.buildBundle(`client-${skin}`, true);
48
- }
49
- require.main.require('./src/meta/minifier').killAll();
50
- } catch (err) {
51
- console.error(err.stack);
52
- }
53
- }
54
-
55
- library.addAdminNavigation = async function (header) {
56
- header.plugins.push({
57
- route: '/plugins/harmony',
58
- icon: 'fa-paint-brush',
59
- name: '[[themes/harmony:theme-name]]',
60
- });
61
- return header;
62
- };
63
-
64
- library.addProfileItem = async (data) => {
65
- data.links.push({
66
- id: 'theme',
67
- route: 'theme',
68
- icon: 'fa-paint-brush',
69
- name: '[[themes/harmony:settings.title]]',
70
- visibility: {
71
- self: true,
72
- other: false,
73
- moderator: false,
74
- globalMod: false,
75
- admin: false,
76
- },
77
- });
78
-
79
- return data;
80
- };
81
-
82
- library.defineWidgetAreas = async function (areas) {
83
- const locations = ['header', 'sidebar', 'footer'];
84
- const templates = [
85
- 'categories.tpl', 'category.tpl', 'topic.tpl', 'users.tpl',
86
- 'unread.tpl', 'recent.tpl', 'popular.tpl', 'top.tpl', 'tags.tpl', 'tag.tpl',
87
- 'login.tpl', 'register.tpl', 'world.tpl',
88
- ];
89
- function capitalizeFirst(str) {
90
- return str.charAt(0).toUpperCase() + str.slice(1);
91
- }
92
- templates.forEach((template) => {
93
- locations.forEach((location) => {
94
- areas.push({
95
- name: `${capitalizeFirst(template.split('.')[0])} ${capitalizeFirst(location)}`,
96
- template: template,
97
- location: location,
98
- });
99
- });
100
- });
101
-
102
- areas = areas.concat([
103
- {
104
- name: 'Main post header',
105
- template: 'topic.tpl',
106
- location: 'mainpost-header',
107
- },
108
- {
109
- name: 'Main post footer',
110
- template: 'topic.tpl',
111
- location: 'mainpost-footer',
112
- },
113
- {
114
- name: 'Sidebar Footer',
115
- template: 'global',
116
- location: 'sidebar-footer',
117
- },
118
- {
119
- name: 'Brand Header',
120
- template: 'global',
121
- location: 'brand-header',
122
- },
123
- {
124
- name: 'About me (before)',
125
- template: 'account/profile.tpl',
126
- location: 'profile-aboutme-before',
127
- },
128
- {
129
- name: 'About me (after)',
130
- template: 'account/profile.tpl',
131
- location: 'profile-aboutme-after',
132
- },
133
- ]);
134
-
135
- return areas;
136
- };
137
-
138
- library.loadThemeConfig = async function (uid) {
139
- const [themeConfig, userConfig] = await Promise.all([
140
- meta.settings.get('harmony'),
141
- user.getSettings(uid),
142
- ]);
143
-
144
- const config = { ...defaults, ...themeConfig, ...(_.pick(userConfig, Object.keys(defaults))) };
145
- config.enableQuickReply = config.enableQuickReply === 'on';
146
- config.enableBreadcrumbs = config.enableBreadcrumbs === 'on';
147
- config.centerHeaderElements = config.centerHeaderElements === 'on';
148
- config.mobileTopicTeasers = config.mobileTopicTeasers === 'on';
149
- config.stickyToolbar = config.stickyToolbar === 'on';
150
- config.autohideBottombar = config.autohideBottombar === 'on';
151
- config.openSidebars = config.openSidebars === 'on';
152
- config.chatModals = config.chatModals === 'on';
153
- return config;
154
- };
155
-
156
- library.getThemeConfig = async function (config) {
157
- config.theme = await library.loadThemeConfig(config.uid);
158
- config.openDraftsOnPageLoad = false;
159
- return config;
160
- };
161
-
162
- library.getAdminSettings = async function (hookData) {
163
- if (hookData.plugin === 'harmony') {
164
- hookData.values = {
165
- ...defaults,
166
- ...hookData.values,
167
- };
168
- }
169
- return hookData;
170
- };
171
-
172
- library.saveUserSettings = async function (hookData) {
173
- Object.keys(defaults).forEach((key) => {
174
- if (hookData.data.hasOwnProperty(key)) {
175
- hookData.settings[key] = hookData.data[key] || undefined;
176
- }
177
- });
178
- return hookData;
179
- };
180
-
181
- library.filterMiddlewareRenderHeader = async function (hookData) {
182
- hookData.templateData.bootswatchSkinOptions = await meta.css.getSkinSwitcherOptions(hookData.req.uid);
183
- return hookData;
1
+ 'use strict';
2
+
3
+ const nconf = require.main.require('nconf');
4
+ const meta = require.main.require('./src/meta');
5
+ const _ = require.main.require('lodash');
6
+ const user = require.main.require('./src/user');
7
+
8
+ const controllers = require('./lib/controllers');
9
+
10
+ const library = module.exports;
11
+
12
+ const defaults = {
13
+ enableQuickReply: 'on',
14
+ enableBreadcrumbs: 'on',
15
+ centerHeaderElements: 'off',
16
+ mobileTopicTeasers: 'off',
17
+ stickyToolbar: 'on',
18
+ autohideBottombar: 'on',
19
+ openSidebars: 'off',
20
+ chatModals: 'off',
21
+ };
22
+
23
+ library.init = async function (params) {
24
+ const { router, middleware } = params;
25
+ const routeHelpers = require.main.require('./src/routes/helpers');
26
+
27
+ routeHelpers.setupAdminPageRoute(router, '/admin/plugins/harmony', [], controllers.renderAdminPage);
28
+
29
+ routeHelpers.setupPageRoute(router, '/user/:userslug/theme', [
30
+ middleware.exposeUid,
31
+ middleware.ensureLoggedIn,
32
+ middleware.canViewUsers,
33
+ middleware.checkAccountPermissions,
34
+ ], controllers.renderThemeSettings);
35
+
36
+ if (nconf.get('isPrimary') && process.env.NODE_ENV === 'production') {
37
+ setTimeout(buildSkins, 0);
38
+ }
39
+ };
40
+
41
+ async function buildSkins() {
42
+ try {
43
+ const plugins = require.main.require('./src/plugins');
44
+ await plugins.prepareForBuild(['client side styles']);
45
+ for (const skin of meta.css.supportedSkins) {
46
+ // eslint-disable-next-line no-await-in-loop
47
+ await meta.css.buildBundle(`client-${skin}`, true);
48
+ }
49
+ require.main.require('./src/meta/minifier').killAll();
50
+ } catch (err) {
51
+ console.error(err.stack);
52
+ }
53
+ }
54
+
55
+ library.addAdminNavigation = async function (header) {
56
+ header.plugins.push({
57
+ route: '/plugins/harmony',
58
+ icon: 'fa-paint-brush',
59
+ name: '[[themes/harmony:theme-name]]',
60
+ });
61
+ return header;
62
+ };
63
+
64
+ library.addProfileItem = async (data) => {
65
+ data.links.push({
66
+ id: 'theme',
67
+ route: 'theme',
68
+ icon: 'fa-paint-brush',
69
+ name: '[[themes/harmony:settings.title]]',
70
+ visibility: {
71
+ self: true,
72
+ other: false,
73
+ moderator: false,
74
+ globalMod: false,
75
+ admin: false,
76
+ },
77
+ });
78
+
79
+ return data;
80
+ };
81
+
82
+ library.defineWidgetAreas = async function (areas) {
83
+ const locations = ['header', 'sidebar', 'footer'];
84
+ const templates = [
85
+ 'categories.tpl', 'category.tpl', 'topic.tpl', 'users.tpl',
86
+ 'unread.tpl', 'recent.tpl', 'popular.tpl', 'top.tpl', 'tags.tpl', 'tag.tpl',
87
+ 'login.tpl', 'register.tpl', 'world.tpl',
88
+ ];
89
+ function capitalizeFirst(str) {
90
+ return str.charAt(0).toUpperCase() + str.slice(1);
91
+ }
92
+ templates.forEach((template) => {
93
+ locations.forEach((location) => {
94
+ areas.push({
95
+ name: `${capitalizeFirst(template.split('.')[0])} ${capitalizeFirst(location)}`,
96
+ template: template,
97
+ location: location,
98
+ });
99
+ });
100
+ });
101
+
102
+ areas = areas.concat([
103
+ {
104
+ name: 'Main post header',
105
+ template: 'topic.tpl',
106
+ location: 'mainpost-header',
107
+ },
108
+ {
109
+ name: 'Main post footer',
110
+ template: 'topic.tpl',
111
+ location: 'mainpost-footer',
112
+ },
113
+ {
114
+ name: 'Sidebar Footer',
115
+ template: 'global',
116
+ location: 'sidebar-footer',
117
+ },
118
+ {
119
+ name: 'Brand Header',
120
+ template: 'global',
121
+ location: 'brand-header',
122
+ },
123
+ {
124
+ name: 'About me (before)',
125
+ template: 'account/profile.tpl',
126
+ location: 'profile-aboutme-before',
127
+ },
128
+ {
129
+ name: 'About me (after)',
130
+ template: 'account/profile.tpl',
131
+ location: 'profile-aboutme-after',
132
+ },
133
+ ]);
134
+
135
+ return areas;
136
+ };
137
+
138
+ library.loadThemeConfig = async function (uid) {
139
+ const [themeConfig, userConfig] = await Promise.all([
140
+ meta.settings.get('harmony'),
141
+ user.getSettings(uid),
142
+ ]);
143
+
144
+ const config = { ...defaults, ...themeConfig, ...(_.pick(userConfig, Object.keys(defaults))) };
145
+ config.enableQuickReply = config.enableQuickReply === 'on';
146
+ config.enableBreadcrumbs = config.enableBreadcrumbs === 'on';
147
+ config.centerHeaderElements = config.centerHeaderElements === 'on';
148
+ config.mobileTopicTeasers = config.mobileTopicTeasers === 'on';
149
+ config.stickyToolbar = config.stickyToolbar === 'on';
150
+ config.autohideBottombar = config.autohideBottombar === 'on';
151
+ config.openSidebars = config.openSidebars === 'on';
152
+ config.chatModals = config.chatModals === 'on';
153
+ return config;
154
+ };
155
+
156
+ library.getThemeConfig = async function (config) {
157
+ config.theme = await library.loadThemeConfig(config.uid);
158
+ config.openDraftsOnPageLoad = false;
159
+ return config;
160
+ };
161
+
162
+ library.getAdminSettings = async function (hookData) {
163
+ if (hookData.plugin === 'harmony') {
164
+ hookData.values = {
165
+ ...defaults,
166
+ ...hookData.values,
167
+ };
168
+ }
169
+ return hookData;
170
+ };
171
+
172
+ library.saveUserSettings = async function (hookData) {
173
+ Object.keys(defaults).forEach((key) => {
174
+ if (hookData.data.hasOwnProperty(key)) {
175
+ hookData.settings[key] = hookData.data[key] || undefined;
176
+ }
177
+ });
178
+ return hookData;
179
+ };
180
+
181
+ library.filterMiddlewareRenderHeader = async function (hookData) {
182
+ hookData.templateData.bootswatchSkinOptions = await meta.css.getSkinSwitcherOptions(hookData.req.uid);
183
+ return hookData;
184
184
  };
package/package.json CHANGED
@@ -1,48 +1,48 @@
1
- {
2
- "name": "nodebb-theme-harmony",
3
- "version": "2.0.1",
4
- "nbbpm": {
5
- "compatibility": "^3.7.0"
6
- },
7
- "description": "Harmony theme for NodeBB",
8
- "main": "library.js",
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/NodeBB/nodebb-theme-harmony"
12
- },
13
- "scripts": {
14
- "lint": "eslint ."
15
- },
16
- "keywords": [
17
- "nodebb",
18
- "theme",
19
- "forum",
20
- "bootstrap",
21
- "responsive"
22
- ],
23
- "contributors": [
24
- {
25
- "name": "Julian Lam",
26
- "email": "julian@nodebb.org",
27
- "url": "https://github.com/julianlam"
28
- },
29
- {
30
- "name": "Barış Soner Uşaklı",
31
- "email": "baris@nodebb.org",
32
- "url": "https://github.com/barisusakli"
33
- }
34
- ],
35
- "license": "MIT",
36
- "bugs": {
37
- "url": "https://github.com/NodeBB/nodebb-theme-harmony/issues"
38
- },
39
- "dependencies": {
40
- "@fontsource/inter": "5.0.15",
41
- "@fontsource/poppins": "5.0.8"
42
- },
43
- "devDependencies": {
44
- "eslint": "^9.0.0",
45
- "eslint-config-nodebb": "^0.2.0",
46
- "eslint-plugin-import": "^2.24.2"
47
- }
48
- }
1
+ {
2
+ "name": "nodebb-theme-harmony",
3
+ "version": "2.0.3",
4
+ "nbbpm": {
5
+ "compatibility": "^3.7.0"
6
+ },
7
+ "description": "Harmony theme for NodeBB",
8
+ "main": "library.js",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/NodeBB/nodebb-theme-harmony"
12
+ },
13
+ "scripts": {
14
+ "lint": "eslint ."
15
+ },
16
+ "keywords": [
17
+ "nodebb",
18
+ "theme",
19
+ "forum",
20
+ "bootstrap",
21
+ "responsive"
22
+ ],
23
+ "contributors": [
24
+ {
25
+ "name": "Julian Lam",
26
+ "email": "julian@nodebb.org",
27
+ "url": "https://github.com/julianlam"
28
+ },
29
+ {
30
+ "name": "Barış Soner Uşaklı",
31
+ "email": "baris@nodebb.org",
32
+ "url": "https://github.com/barisusakli"
33
+ }
34
+ ],
35
+ "license": "MIT",
36
+ "bugs": {
37
+ "url": "https://github.com/NodeBB/nodebb-theme-harmony/issues"
38
+ },
39
+ "dependencies": {
40
+ "@fontsource/inter": "5.0.15",
41
+ "@fontsource/poppins": "5.0.8"
42
+ },
43
+ "devDependencies": {
44
+ "eslint": "^9.0.0",
45
+ "eslint-config-nodebb": "^0.2.0",
46
+ "eslint-plugin-import": "^2.24.2"
47
+ }
48
+ }
package/plugin.json CHANGED
@@ -1,25 +1,25 @@
1
- {
2
- "id": "nodebb-theme-harmony",
3
- "hooks": [
4
- { "hook": "static:app.load", "method": "init" },
5
- { "hook": "filter:admin.header.build", "method": "addAdminNavigation" },
6
- { "hook": "filter:widgets.getAreas", "method": "defineWidgetAreas" },
7
- { "hook": "filter:config.get", "method": "getThemeConfig" },
8
- { "hook": "filter:settings.get", "method": "getAdminSettings"},
9
- { "hook": "filter:user.saveSettings", "method": "saveUserSettings" },
10
- { "hook": "filter:user.profileMenu", "method": "addProfileItem" },
11
- { "hook": "filter:middleware.renderHeader", "method": "filterMiddlewareRenderHeader" }
12
- ],
13
- "scripts": [
14
- "public/harmony.js"
15
- ],
16
- "modules": {
17
- "../admin/plugins/harmony.js": "public/admin.js",
18
- "../client/account/theme.js": "public/settings.js"
19
- },
20
- "staticDirs": {
21
- "inter": "node_modules/@fontsource/inter/files",
22
- "poppins": "node_modules/@fontsource/poppins/files"
23
- },
24
- "languages": "languages"
1
+ {
2
+ "id": "nodebb-theme-harmony",
3
+ "hooks": [
4
+ { "hook": "static:app.load", "method": "init" },
5
+ { "hook": "filter:admin.header.build", "method": "addAdminNavigation" },
6
+ { "hook": "filter:widgets.getAreas", "method": "defineWidgetAreas" },
7
+ { "hook": "filter:config.get", "method": "getThemeConfig" },
8
+ { "hook": "filter:settings.get", "method": "getAdminSettings"},
9
+ { "hook": "filter:user.saveSettings", "method": "saveUserSettings" },
10
+ { "hook": "filter:user.profileMenu", "method": "addProfileItem" },
11
+ { "hook": "filter:middleware.renderHeader", "method": "filterMiddlewareRenderHeader" }
12
+ ],
13
+ "scripts": [
14
+ "public/harmony.js"
15
+ ],
16
+ "modules": {
17
+ "../admin/plugins/harmony.js": "public/admin.js",
18
+ "../client/account/theme.js": "public/settings.js"
19
+ },
20
+ "staticDirs": {
21
+ "inter": "node_modules/@fontsource/inter/files",
22
+ "poppins": "node_modules/@fontsource/poppins/files"
23
+ },
24
+ "languages": "languages"
25
25
  }
package/public/.eslintrc CHANGED
@@ -1,3 +1,3 @@
1
- {
2
- "extends": "nodebb/public"
3
- }
1
+ {
2
+ "extends": "nodebb/public"
3
+ }
package/public/admin.js CHANGED
@@ -1,15 +1,15 @@
1
- 'use strict';
2
-
3
- define('admin/plugins/harmony', ['settings'], function (Settings) {
4
- var ACP = {};
5
-
6
- ACP.init = function () {
7
- Settings.load('harmony', $('.harmony-settings'));
8
-
9
- $('#save').on('click', function () {
10
- Settings.save('harmony', $('.harmony-settings'));
11
- });
12
- };
13
-
14
- return ACP;
15
- });
1
+ 'use strict';
2
+
3
+ define('admin/plugins/harmony', ['settings'], function (Settings) {
4
+ var ACP = {};
5
+
6
+ ACP.init = function () {
7
+ Settings.load('harmony', $('.harmony-settings'));
8
+
9
+ $('#save').on('click', function () {
10
+ Settings.save('harmony', $('.harmony-settings'));
11
+ });
12
+ };
13
+
14
+ return ACP;
15
+ });