nodebb-theme-harmony 2.0.0-pre.9 → 2.0.1

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 (163) hide show
  1. package/.eslintrc +3 -3
  2. package/README.md +22 -19
  3. package/lib/controllers.js +29 -29
  4. package/library.js +184 -190
  5. package/package.json +48 -48
  6. package/plugin.json +24 -25
  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 -128
  16. package/scss/fonts.scss +19 -19
  17. package/scss/groups.scss +22 -22
  18. package/scss/harmony.scss +24 -25
  19. package/scss/header.scss +15 -15
  20. package/scss/mixins.scss +183 -176
  21. package/scss/modals.scss +6 -6
  22. package/scss/modules/breadcrumbs.scss +15 -15
  23. package/scss/modules/cover.scss +102 -104
  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 -61
  32. package/scss/sidebar.scss +188 -189
  33. package/scss/skins.scss +58 -49
  34. package/scss/status.scss +24 -24
  35. package/scss/topic.scss +130 -138
  36. package/templates/account/blocks.tpl +51 -40
  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 -30
  41. package/templates/account/edit.tpl +137 -122
  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 -201
  46. package/templates/account/posts.tpl +35 -35
  47. package/templates/account/profile.tpl +92 -95
  48. package/templates/account/read.tpl +1 -0
  49. package/templates/account/sessions.tpl +8 -8
  50. package/templates/account/settings.tpl +236 -236
  51. package/templates/account/shares.tpl +20 -0
  52. package/templates/account/tags.tpl +12 -12
  53. package/templates/account/theme.tpl +63 -63
  54. package/templates/account/topics.tpl +44 -43
  55. package/templates/account/uploads.tpl +37 -37
  56. package/templates/admin/plugins/harmony.tpl +57 -56
  57. package/templates/categories.tpl +29 -29
  58. package/templates/category.tpl +72 -72
  59. package/templates/footer.tpl +17 -17
  60. package/templates/groups/details.tpl +86 -86
  61. package/templates/groups/list.tpl +58 -56
  62. package/templates/groups/members.tpl +9 -9
  63. package/templates/header.tpl +45 -45
  64. package/templates/notifications.tpl +32 -32
  65. package/templates/partials/account/admin-menu.tpl +36 -36
  66. package/templates/partials/account/category-item.tpl +22 -22
  67. package/templates/partials/account/footer.tpl +2 -2
  68. package/templates/partials/account/header.tpl +98 -98
  69. package/templates/partials/account/session-list.tpl +18 -18
  70. package/templates/partials/account/sidebar-left.tpl +116 -102
  71. package/templates/partials/breadcrumbs-json-ld.tpl +16 -26
  72. package/templates/partials/breadcrumbs.tpl +12 -12
  73. package/templates/partials/buttons/newTopic.tpl +22 -22
  74. package/templates/partials/categories/item.tpl +56 -56
  75. package/templates/partials/categories/lastpost.tpl +24 -24
  76. package/templates/partials/categories/link.tpl +4 -4
  77. package/templates/partials/category/subcategory.tpl +18 -18
  78. package/templates/partials/category/tags.tpl +3 -3
  79. package/templates/partials/cookie-consent.tpl +6 -6
  80. package/templates/partials/groups/admin.tpl +95 -95
  81. package/templates/partials/groups/invited.tpl +32 -32
  82. package/templates/partials/groups/list.tpl +15 -15
  83. package/templates/partials/groups/memberlist.tpl +46 -46
  84. package/templates/partials/groups/pending.tpl +29 -29
  85. package/templates/partials/groups/sidebar-left.tpl +27 -27
  86. package/templates/partials/header/brand.tpl +27 -25
  87. package/templates/partials/mobile-footer.tpl +95 -98
  88. package/templates/partials/notifications_list.tpl +44 -44
  89. package/templates/partials/paginator.tpl +46 -46
  90. package/templates/partials/post_bar.tpl +27 -29
  91. package/templates/partials/posts_list.tpl +7 -7
  92. package/templates/partials/posts_list_item.tpl +19 -19
  93. package/templates/partials/quick-search-results.tpl +46 -46
  94. package/templates/partials/search-filters.tpl +183 -183
  95. package/templates/partials/search-results.tpl +54 -54
  96. package/templates/partials/sidebar/chats.tpl +45 -45
  97. package/templates/partials/sidebar/drafts.tpl +63 -63
  98. package/templates/partials/sidebar/logged-in-menu.tpl +22 -22
  99. package/templates/partials/sidebar/logged-out-menu.tpl +44 -44
  100. package/templates/partials/sidebar/notifications.tpl +49 -49
  101. package/templates/partials/sidebar/search-mobile.tpl +28 -28
  102. package/templates/partials/sidebar/search.tpl +30 -30
  103. package/templates/partials/sidebar/user-menu.tpl +103 -103
  104. package/templates/partials/sidebar-left.tpl +39 -42
  105. package/templates/partials/sidebar-right.tpl +16 -16
  106. package/templates/partials/skin-switcher.tpl +50 -50
  107. package/templates/partials/tags_list.tpl +7 -5
  108. package/templates/partials/toast.tpl +19 -19
  109. package/templates/partials/topic/event.tpl +12 -12
  110. package/templates/partials/topic/navigation-post.tpl +9 -9
  111. package/templates/partials/topic/navigator-mobile.tpl +61 -61
  112. package/templates/partials/topic/navigator.tpl +26 -26
  113. package/templates/partials/topic/necro-post.tpl +5 -5
  114. package/templates/partials/topic/post-menu-list.tpl +156 -140
  115. package/templates/partials/topic/post-menu.tpl +4 -30
  116. package/templates/partials/topic/post-placeholder.tpl +14 -14
  117. package/templates/partials/topic/post.tpl +146 -139
  118. package/templates/partials/topic/quickreply.tpl +28 -28
  119. package/templates/partials/topic/reply-button.tpl +26 -24
  120. package/templates/partials/topic/selection-tooltip.tpl +2 -2
  121. package/templates/partials/topic/sort.tpl +27 -27
  122. package/templates/partials/topic/stats.tpl +14 -14
  123. package/templates/partials/topic/thumbs.tpl +4 -4
  124. package/templates/partials/topic/tools.tpl +8 -12
  125. package/templates/partials/topic/topic-menu-list.tpl +73 -73
  126. package/templates/partials/topic/watch.tpl +59 -59
  127. package/templates/partials/topic-filters.tpl +15 -15
  128. package/templates/partials/topic-list-bar.tpl +54 -54
  129. package/templates/partials/topic-terms.tpl +15 -15
  130. package/templates/partials/topics_list.tpl +131 -123
  131. package/templates/partials/users/item.tpl +39 -37
  132. package/templates/partials/users_list.tpl +4 -4
  133. package/templates/partials/users_list_menu.tpl +14 -14
  134. package/templates/popular.tpl +34 -34
  135. package/templates/post-queue.tpl +211 -207
  136. package/templates/recent.tpl +42 -35
  137. package/templates/search.tpl +46 -46
  138. package/templates/tag.tpl +34 -34
  139. package/templates/tags.tpl +49 -49
  140. package/templates/top.tpl +34 -34
  141. package/templates/topic.tpl +123 -130
  142. package/templates/unread.tpl +31 -31
  143. package/templates/users.tpl +39 -39
  144. package/templates/world.tpl +66 -35
  145. package/theme.json +6 -6
  146. package/package-lock.json +0 -2368
  147. package/scss/modules/bottom-sheet.scss +0 -52
  148. package/templates/flags/detail.tpl +0 -179
  149. package/templates/flags/list.tpl +0 -6
  150. package/templates/login.tpl +0 -102
  151. package/templates/partials/category/filter-dropdown-content.tpl +0 -41
  152. package/templates/partials/category/selector-dropdown-content.tpl +0 -39
  153. package/templates/partials/category/sort.tpl +0 -39
  154. package/templates/partials/category/tools.tpl +0 -89
  155. package/templates/partials/category/watch.tpl +0 -67
  156. package/templates/partials/flags/bulk-actions.tpl +0 -9
  157. package/templates/partials/flags/filters.tpl +0 -189
  158. package/templates/partials/flags/results.tpl +0 -38
  159. package/templates/partials/groups/filter-dropdown-content.tpl +0 -25
  160. package/templates/partials/tags/filter-dropdown-content.tpl +0 -38
  161. package/templates/partials/tags/watch.tpl +0 -42
  162. package/templates/partials/users/filter-dropdown-content.tpl +0 -23
  163. package/templates/register.tpl +0 -104
package/.eslintrc CHANGED
@@ -1,3 +1,3 @@
1
- {
2
- "extends": "nodebb"
3
- }
1
+ {
2
+ "extends": "nodebb"
3
+ }
package/README.md CHANGED
@@ -1,19 +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
- <img height="450" src="screenshots/categories.png">
14
-
15
- ### Recent
16
- <img height="450" src="screenshots/recent.png">
17
-
18
- ### Topic
19
- <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,190 +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;
184
- };
185
-
186
- library.filterTeasersConfigureStripTags = function (hookData) {
187
- // teasers have a stretched-link to go to last post, the anchors in them are not clickable
188
- hookData.tags.push('a');
189
- return hookData;
190
- };
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
+ };
package/package.json CHANGED
@@ -1,48 +1,48 @@
1
- {
2
- "name": "nodebb-theme-harmony",
3
- "version": "2.0.0-pre.9",
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": "^8.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.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
+ }
package/plugin.json CHANGED
@@ -1,26 +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
- { "hook": "filter:teasers.configureStripTags", "method": "filterTeasersConfigureStripTags"}
13
- ],
14
- "scripts": [
15
- "public/harmony.js"
16
- ],
17
- "modules": {
18
- "../admin/plugins/harmony.js": "public/admin.js",
19
- "../client/account/theme.js": "public/settings.js"
20
- },
21
- "staticDirs": {
22
- "inter": "node_modules/@fontsource/inter/files",
23
- "poppins": "node_modules/@fontsource/poppins/files"
24
- },
25
- "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"
26
25
  }
package/public/.eslintrc CHANGED
@@ -1,3 +1,3 @@
1
- {
2
- "extends": "nodebb/public"
3
- }
1
+ {
2
+ "extends": "nodebb/public"
3
+ }