nodebb-theme-harmony 1.0.0 → 1.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 (155) hide show
  1. package/README.md +12 -1
  2. package/languages/en-GB/harmony.json +6 -1
  3. package/library.js +56 -25
  4. package/package.json +1 -1
  5. package/plugin.json +0 -1
  6. package/public/harmony.js +165 -41
  7. package/public/settings.js +1 -0
  8. package/screenshots/categories.png +0 -0
  9. package/screenshots/recent.png +0 -0
  10. package/screenshots/topic.png +0 -0
  11. package/scss/account.scss +1 -1
  12. package/scss/chats.scss +81 -26
  13. package/scss/common.scss +84 -10
  14. package/scss/flags.scss +5 -0
  15. package/scss/groups.scss +2 -2
  16. package/scss/harmony.scss +3 -0
  17. package/scss/mixins.scss +7 -3
  18. package/scss/modals.scss +5 -3
  19. package/scss/modules/bottom-sheet.scss +1 -1
  20. package/scss/modules/composer.scss +0 -4
  21. package/scss/modules/cover.scss +1 -11
  22. package/scss/modules/filters.scss +8 -0
  23. package/scss/modules/paginator.scss +24 -0
  24. package/scss/modules/tags.scss +2 -2
  25. package/scss/modules/topic-navigator.scss +18 -42
  26. package/scss/modules/topics-list.scss +32 -17
  27. package/scss/modules/user-menu.scss +6 -0
  28. package/scss/overrides.scss +4 -1
  29. package/scss/sidebar.scss +61 -8
  30. package/scss/topic.scss +36 -13
  31. package/templates/account/blocks.tpl +35 -40
  32. package/templates/account/categories.tpl +47 -29
  33. package/templates/account/consent.tpl +66 -10
  34. package/templates/account/edit/password.tpl +25 -30
  35. package/templates/account/edit/username.tpl +21 -26
  36. package/templates/account/edit.tpl +105 -116
  37. package/templates/account/followers.tpl +12 -19
  38. package/templates/account/following.tpl +12 -18
  39. package/templates/account/groups.tpl +12 -17
  40. package/templates/account/info.tpl +178 -206
  41. package/templates/account/posts.tpl +31 -36
  42. package/templates/account/profile.tpl +82 -72
  43. package/templates/account/sessions.tpl +8 -30
  44. package/templates/account/settings.tpl +222 -203
  45. package/templates/account/theme.tpl +39 -25
  46. package/templates/account/topics.tpl +36 -38
  47. package/templates/account/uploads.tpl +33 -40
  48. package/templates/admin/plugins/harmony.tpl +21 -3
  49. package/templates/categories.tpl +3 -6
  50. package/templates/category.tpl +13 -14
  51. package/templates/chats.tpl +9 -10
  52. package/templates/flags/detail.tpl +160 -193
  53. package/templates/flags/list.tpl +3 -70
  54. package/templates/footer.tpl +2 -2
  55. package/templates/groups/details.tpl +22 -19
  56. package/templates/groups/list.tpl +1 -1
  57. package/templates/groups/members.tpl +0 -2
  58. package/templates/header.tpl +2 -2
  59. package/templates/login.tpl +4 -4
  60. package/templates/notifications.tpl +5 -5
  61. package/templates/partials/account/admin-menu.tpl +9 -9
  62. package/templates/partials/account/category-item.tpl +14 -17
  63. package/templates/partials/account/footer.tpl +3 -0
  64. package/templates/partials/account/header.tpl +78 -81
  65. package/templates/partials/account/session-list.tpl +18 -0
  66. package/templates/partials/account/sidebar-left.tpl +31 -25
  67. package/templates/partials/breadcrumbs.tpl +6 -6
  68. package/templates/partials/buttons/newTopic.tpl +1 -1
  69. package/templates/partials/categories/item.tpl +31 -27
  70. package/templates/partials/categories/lastpost.tpl +7 -7
  71. package/templates/partials/category/filter-dropdown-content.tpl +37 -0
  72. package/templates/partials/{category-selector-content.tpl → category/selector-dropdown-content.tpl} +7 -7
  73. package/templates/partials/category/sort.tpl +22 -7
  74. package/templates/partials/category/subcategory.tpl +2 -3
  75. package/templates/partials/category/tags.tpl +0 -2
  76. package/templates/partials/category/tools.tpl +28 -25
  77. package/templates/partials/category/watch.tpl +39 -6
  78. package/templates/partials/chats/dropdown.tpl +4 -1
  79. package/templates/partials/chats/message-window.tpl +12 -8
  80. package/templates/partials/chats/message.tpl +8 -10
  81. package/templates/partials/chats/options.tpl +14 -6
  82. package/templates/partials/chats/recent_room.tpl +41 -32
  83. package/templates/partials/cookie-consent.tpl +5 -5
  84. package/templates/partials/flags/bulk-actions.tpl +9 -0
  85. package/templates/partials/flags/filters.tpl +165 -78
  86. package/templates/partials/flags/results.tpl +38 -0
  87. package/templates/partials/groups/admin.tpl +4 -4
  88. package/templates/partials/groups/badge.tpl +1 -1
  89. package/templates/partials/groups/invited.tpl +1 -1
  90. package/templates/partials/groups/list.tpl +2 -2
  91. package/templates/partials/groups/memberlist.tpl +2 -2
  92. package/templates/partials/groups/sidebar-left.tpl +10 -10
  93. package/templates/partials/header/brand.tpl +9 -2
  94. package/templates/partials/mobile-footer.tpl +69 -61
  95. package/templates/partials/notifications_list.tpl +11 -8
  96. package/templates/partials/paginator.tpl +11 -9
  97. package/templates/partials/post_bar.tpl +26 -24
  98. package/templates/partials/posts_list_item.tpl +5 -5
  99. package/templates/partials/quick-search-results.tpl +3 -3
  100. package/templates/partials/search-filters.tpl +184 -0
  101. package/templates/partials/search-results.tpl +28 -35
  102. package/templates/partials/sidebar/chats.tpl +26 -34
  103. package/templates/partials/sidebar/drafts.tpl +45 -34
  104. package/templates/partials/sidebar/logged-in-menu.tpl +5 -5
  105. package/templates/partials/sidebar/logged-out-menu.tpl +1 -1
  106. package/templates/partials/sidebar/notifications.tpl +30 -9
  107. package/templates/partials/sidebar/search-mobile.tpl +1 -1
  108. package/templates/partials/sidebar/search.tpl +1 -1
  109. package/templates/partials/sidebar/user-menu.tpl +38 -29
  110. package/templates/partials/sidebar-left.tpl +14 -11
  111. package/templates/partials/sidebar-right.tpl +1 -3
  112. package/templates/partials/skin-switcher.tpl +3 -3
  113. package/templates/partials/tags/filter-dropdown-content.tpl +34 -0
  114. package/templates/partials/tags_list.tpl +4 -4
  115. package/templates/partials/topic/browsing-users.tpl +0 -2
  116. package/templates/partials/topic/event.tpl +1 -1
  117. package/templates/partials/topic/navigation-post.tpl +5 -9
  118. package/templates/partials/topic/navigator-mobile.tpl +62 -0
  119. package/templates/partials/topic/navigator.tpl +23 -17
  120. package/templates/partials/topic/post-editor.tpl +0 -2
  121. package/templates/partials/topic/post-menu-list.tpl +60 -62
  122. package/templates/partials/topic/post-menu.tpl +16 -11
  123. package/templates/partials/topic/post.tpl +45 -27
  124. package/templates/partials/topic/quickreply.tpl +8 -8
  125. package/templates/partials/topic/reply-button.tpl +7 -7
  126. package/templates/partials/topic/sort.tpl +17 -5
  127. package/templates/partials/topic/tools.tpl +2 -2
  128. package/templates/partials/topic/topic-menu-list.tpl +22 -24
  129. package/templates/partials/topic/watch.tpl +42 -9
  130. package/templates/partials/topic-filters.tpl +6 -3
  131. package/templates/partials/topic-list-bar.tpl +50 -46
  132. package/templates/partials/topic-terms.tpl +6 -3
  133. package/templates/partials/topics_list.tpl +88 -93
  134. package/templates/partials/userFilter-placeholders.tpl +5 -0
  135. package/templates/partials/users/filter-dropdown-content.tpl +23 -0
  136. package/templates/partials/users/item.tpl +25 -27
  137. package/templates/partials/users_list.tpl +1 -1
  138. package/templates/popular.tpl +3 -1
  139. package/templates/post-queue.tpl +166 -0
  140. package/templates/recent.tpl +3 -2
  141. package/templates/register.tpl +4 -4
  142. package/templates/search.tpl +39 -177
  143. package/templates/tags.tpl +3 -3
  144. package/templates/top.tpl +3 -1
  145. package/templates/topic.tpl +74 -68
  146. package/templates/unread.tpl +3 -1
  147. package/templates/users.tpl +7 -3
  148. package/templates/modules/usercard.tpl +0 -39
  149. package/templates/partials/acceptTos.tpl +0 -11
  150. package/templates/partials/category-filter-content.tpl +0 -30
  151. package/templates/partials/category-filter-right.tpl +0 -5
  152. package/templates/partials/category-filter.tpl +0 -3
  153. package/templates/partials/category-selector-right.tpl +0 -5
  154. package/templates/partials/category-selector.tpl +0 -3
  155. package/templates/partials/slideout-menu.tpl +0 -6
package/README.md CHANGED
@@ -5,4 +5,15 @@ The Harmony theme is the default theme for NodeBB for versions spanning v3.0.0 o
5
5
 
6
6
  ## Issues
7
7
 
8
- Issues are tracked in [the main project issue tracker](https://github.com/NodeBB/NodeBB/issues?q=is%3Aopen+is%3Aissue+label%3Athemes).
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,9 +1,14 @@
1
1
  {
2
2
  "skins": "Skins",
3
3
  "collapse": "Collapse",
4
+ "expand": "Expand",
4
5
  "login-register-to-search": "Login or register to search.",
5
6
  "settings.title": "Theme settings",
6
7
  "settings.enableQuickReply": "Enable quick reply",
7
8
  "settings.centerHeaderElements": "Center header elements",
8
- "settings.stickyToolbar": "Sticky toolbar"
9
+ "settings.mobileTopicTeasers": "Show topic teasers on mobile",
10
+ "settings.stickyToolbar": "Sticky toolbar",
11
+ "settings.stickyToolbar.help": "The toolbar on topic and category pages will stick to the top of the page",
12
+ "settings.autohideBottombar": "Auto hide bottom bar",
13
+ "settings.autohideBottombar.help": "The bottom bar on mobile view will be hidden when the page is scrolled down"
9
14
  }
package/library.js CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ const nconf = require.main.require('nconf');
3
4
  const meta = require.main.require('./src/meta');
4
5
  const _ = require.main.require('lodash');
5
6
  const user = require.main.require('./src/user');
@@ -11,7 +12,9 @@ const library = module.exports;
11
12
  const defaults = {
12
13
  enableQuickReply: 'on',
13
14
  centerHeaderElements: 'off',
15
+ mobileTopicTeasers: 'off',
14
16
  stickyToolbar: 'on',
17
+ autohideBottombar: 'off',
15
18
  openSidebars: 'off',
16
19
  };
17
20
 
@@ -27,8 +30,26 @@ library.init = async function (params) {
27
30
  middleware.canViewUsers,
28
31
  middleware.checkAccountPermissions,
29
32
  ], controllers.renderThemeSettings);
33
+
34
+ if (nconf.get('isPrimary') && process.env.NODE_ENV === 'production') {
35
+ setTimeout(buildSkins, 0);
36
+ }
30
37
  };
31
38
 
39
+ async function buildSkins() {
40
+ try {
41
+ const plugins = require.main.require('./src/plugins');
42
+ await plugins.prepareForBuild(['client side styles']);
43
+ for (const skin of meta.css.supportedSkins) {
44
+ // eslint-disable-next-line no-await-in-loop
45
+ await meta.css.buildBundle(`client-${skin}`, true);
46
+ }
47
+ require.main.require('./src/meta/minifier').killAll();
48
+ } catch (err) {
49
+ console.error(err.stack);
50
+ }
51
+ }
52
+
32
53
  library.addAdminNavigation = async function (header) {
33
54
  header.plugins.push({
34
55
  route: '/plugins/harmony',
@@ -77,11 +98,36 @@ library.defineWidgetAreas = async function (areas) {
77
98
  });
78
99
 
79
100
  areas = areas.concat([
101
+ {
102
+ name: 'Main post header',
103
+ template: 'topic.tpl',
104
+ location: 'mainpost-header',
105
+ },
106
+ {
107
+ name: 'Main post footer',
108
+ template: 'topic.tpl',
109
+ location: 'mainpost-footer',
110
+ },
80
111
  {
81
112
  name: 'Sidebar Footer',
82
113
  template: 'global',
83
114
  location: 'sidebar-footer',
84
115
  },
116
+ {
117
+ name: 'Brand Header',
118
+ template: 'global',
119
+ location: 'brand-header',
120
+ },
121
+ {
122
+ name: 'About me (before)',
123
+ template: 'account/profile.tpl',
124
+ location: 'profile-aboutme-before',
125
+ },
126
+ {
127
+ name: 'About me (after)',
128
+ template: 'account/profile.tpl',
129
+ location: 'profile-aboutme-after',
130
+ },
85
131
  ]);
86
132
 
87
133
  return areas;
@@ -92,15 +138,19 @@ async function loadThemeConfig(uid) {
92
138
  meta.settings.get('harmony'),
93
139
  user.getSettings(uid),
94
140
  ]);
95
- return { ...defaults, ...themeConfig, ...userConfig };
141
+
142
+ const config = { ...defaults, ...themeConfig, ...(_.pick(userConfig, Object.keys(defaults))) };
143
+ config.enableQuickReply = config.enableQuickReply === 'on';
144
+ config.centerHeaderElements = config.centerHeaderElements === 'on';
145
+ config.mobileTopicTeasers = config.mobileTopicTeasers === 'on';
146
+ config.stickyToolbar = config.stickyToolbar === 'on';
147
+ config.autohideBottombar = config.autohideBottombar === 'on';
148
+ config.openSidebars = config.openSidebars === 'on';
149
+ return config;
96
150
  }
97
151
 
98
152
  library.getThemeConfig = async function (config) {
99
- const themeConfig = await loadThemeConfig(config.uid);
100
- config.enableQuickReply = themeConfig.enableQuickReply === 'on';
101
- config.centerHeaderElements = themeConfig.centerHeaderElements === 'on';
102
- config.stickyToolbar = themeConfig.stickyToolbar === 'on';
103
- config.openSidebars = themeConfig.openSidebars === 'on';
153
+ config.theme = await loadThemeConfig(config.uid);
104
154
  config.openDraftsOnPageLoad = false;
105
155
  return config;
106
156
  };
@@ -124,25 +174,6 @@ library.saveUserSettings = async function (hookData) {
124
174
  return hookData;
125
175
  };
126
176
 
127
- library.addUserToTopic = async function (hookData) {
128
- const { enableQuickReply } = await loadThemeConfig(hookData.req.uid);
129
- if (enableQuickReply === 'on') {
130
- if (hookData.req.user) {
131
- const userData = await user.getUserData(hookData.req.uid);
132
- hookData.templateData.loggedInUser = userData;
133
- } else {
134
- hookData.templateData.loggedInUser = {
135
- uid: 0,
136
- username: '[[global:guest]]',
137
- picture: user.getDefaultAvatar(),
138
- 'icon:text': '?',
139
- 'icon:bgColor': '#aaa',
140
- };
141
- }
142
- }
143
- return hookData;
144
- };
145
-
146
177
  library.filterMiddlewareRenderHeader = async function (hookData) {
147
178
  const userSettings = await user.getSettings(hookData.req.uid);
148
179
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-theme-harmony",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "nbbpm": {
5
5
  "compatibility": "^3.0.0"
6
6
  },
package/plugin.json CHANGED
@@ -8,7 +8,6 @@
8
8
  { "hook": "filter:settings.get", "method": "getAdminSettings"},
9
9
  { "hook": "filter:user.saveSettings", "method": "saveUserSettings" },
10
10
  { "hook": "filter:user.profileMenu", "method": "addProfileItem" },
11
- { "hook": "filter:topic.build", "method": "addUserToTopic" },
12
11
  { "hook": "filter:middleware.renderHeader", "method": "filterMiddlewareRenderHeader" },
13
12
  { "hook": "filter:middleware.render", "method": "removeFinalBreadcrumb" }
14
13
  ],
package/public/harmony.js CHANGED
@@ -1,26 +1,31 @@
1
1
  'use strict';
2
2
 
3
3
  $(document).ready(function () {
4
+ setupSkinSwitcher();
4
5
  setupNProgress();
5
6
  setupMobileMenu();
6
7
  setupSearch();
7
8
  setupDrafts();
9
+ handleMobileNavigator();
10
+ setupNavTooltips();
11
+ fixPlaceholders();
8
12
 
9
- $('[component="skinSwitcher"]').on('click', '.dropdown-item', function () {
10
- const skin = $(this).attr('data-value');
11
- $('[component="skinSwitcher"] .dropdown-item .fa-check').addClass('invisible');
12
- $(this).find('.fa-check').removeClass('invisible');
13
- require(['forum/account/settings'], function (accountSettings) {
14
- $('[component="skinSwitcher"] [component="skinSwitcher/icon"]').addClass('fa-fade');
15
- accountSettings.changeSkin(skin);
13
+ function setupSkinSwitcher() {
14
+ $('[component="skinSwitcher"]').on('click', '.dropdown-item', function () {
15
+ const skin = $(this).attr('data-value');
16
+ $('[component="skinSwitcher"] .dropdown-item .fa-check').addClass('invisible');
17
+ $(this).find('.fa-check').removeClass('invisible');
18
+ require(['forum/account/settings', 'hooks'], function (accountSettings, hooks) {
19
+ hooks.one('action:skin.change', function () {
20
+ $('[component="skinSwitcher"] [component="skinSwitcher/icon"]').removeClass('fa-fade');
21
+ });
22
+ $('[component="skinSwitcher"] [component="skinSwitcher/icon"]').addClass('fa-fade');
23
+ accountSettings.changeSkin(skin);
24
+ });
16
25
  });
17
- });
26
+ }
18
27
 
19
28
  require(['hooks'], function (hooks) {
20
- hooks.on('action:skin.change', function () {
21
- $('[component="skinSwitcher"] [component="skinSwitcher/icon"]').removeClass('fa-fade');
22
- });
23
-
24
29
  $(window).on('action:composer.resize action:sidebar.toggle', function () {
25
30
  $('[component="composer"]').css({
26
31
  left: $('.sidebar-left').outerWidth(true),
@@ -36,7 +41,7 @@ $(document).ready(function () {
36
41
  });
37
42
 
38
43
  function setupMobileMenu() {
39
- require(['api'], function (api) {
44
+ require(['hooks', 'api', 'navigator'], function (hooks, api, navigator) {
40
45
  $('[component="sidebar/toggle"]').on('click', async function () {
41
46
  const sidebarEl = $('.sidebar');
42
47
  sidebarEl.toggleClass('open');
@@ -48,6 +53,73 @@ $(document).ready(function () {
48
53
  });
49
54
  }
50
55
  $(window).trigger('action:sidebar.toggle');
56
+ if (ajaxify.data.template.topic) {
57
+ hooks.fire('action:navigator.update', { newIndex: navigator.getIndex() });
58
+ }
59
+ });
60
+
61
+ const bottomBar = $('[component="bottombar"]');
62
+ const $body = $('body');
63
+ const $window = $(window);
64
+ $body.on('shown.bs.dropdown', '.sticky-tools', function () {
65
+ bottomBar.addClass('hidden');
66
+ });
67
+ $body.on('hidden.bs.dropdown', '.sticky-tools', function () {
68
+ bottomBar.removeClass('hidden');
69
+ });
70
+ function isSearchVisible() {
71
+ return !!$('[component="bottombar"] [component="sidebar/search"] .search-dropdown.show').length;
72
+ }
73
+
74
+ let lastScrollTop = 0;
75
+ let newPostsLoaded = false;
76
+
77
+ function onWindowScroll() {
78
+ const st = $window.scrollTop();
79
+ if (newPostsLoaded) {
80
+ newPostsLoaded = false;
81
+ lastScrollTop = st;
82
+ return;
83
+ }
84
+ if (st !== lastScrollTop && !navigator.scrollActive && !isSearchVisible()) {
85
+ const diff = Math.abs(st - lastScrollTop);
86
+ const scrolledDown = st > lastScrollTop;
87
+ const scrolledUp = st < lastScrollTop;
88
+ if (diff > 5) {
89
+ bottomBar.css({
90
+ bottom: !scrolledUp && scrolledDown ?
91
+ -bottomBar.find('.bottombar-nav').outerHeight(true) :
92
+ 0,
93
+ });
94
+ }
95
+ }
96
+ lastScrollTop = st;
97
+ }
98
+
99
+ const delayedScroll = utils.throttle(onWindowScroll, 250);
100
+ function enableAutohide() {
101
+ $window.off('scroll', delayedScroll);
102
+ if (config.theme.autohideBottombar) {
103
+ lastScrollTop = $window.scrollTop();
104
+ $window.on('scroll', delayedScroll);
105
+ }
106
+ }
107
+
108
+ hooks.on('action:posts.loading', function () {
109
+ $window.off('scroll', delayedScroll);
110
+ });
111
+ hooks.on('action:posts.loaded', function () {
112
+ newPostsLoaded = true;
113
+ setTimeout(enableAutohide, 250);
114
+ });
115
+ hooks.on('action:ajaxify.end', function () {
116
+ $window.off('scroll', delayedScroll);
117
+ $body.removeClass('chat-loaded');
118
+ bottomBar.css({ bottom: 0 });
119
+ setTimeout(enableAutohide, 250);
120
+ });
121
+ hooks.on('action:chat.loaded', function () {
122
+ $body.toggleClass('chat-loaded', !!(ajaxify.data.template.chats && ajaxify.data.roomId));
51
123
  });
52
124
  });
53
125
  }
@@ -56,56 +128,44 @@ $(document).ready(function () {
56
128
  $('[component="sidebar/search"]').on('shown.bs.dropdown', function () {
57
129
  $(this).find('[component="search/fields"] input[name="query"]').trigger('focus');
58
130
  });
59
-
60
- function resizeResults(hookData) {
61
- if (hookData && hookData.data && !hookData.data.posts.length) {
62
- $('.bottombar .quick-search-results').css({ height: 'initial' });
63
- return;
64
- }
65
- const dropdown = $('.bottombar .search-dropdown');
66
- const padY = dropdown.innerHeight() - dropdown.height();
67
- const input = dropdown.find('.input-container').outerHeight(true);
68
- const showMore = dropdown.find('.show-more-container').outerHeight(true);
69
- const newHeight = Math.max(
70
- 150,
71
- $(window).height() - (input + (showMore || 0) + (padY * 2) + 30)
72
- );
73
- $('.bottombar .quick-search-results').height(newHeight);
74
- }
75
- require(['hooks'], function (hooks) {
76
- $(window).on('resize', resizeResults);
77
- hooks.on('action:search.quick.complete', resizeResults);
78
- });
79
131
  }
80
132
 
81
133
  function setupDrafts() {
82
- require(['composer/drafts'], function (drafts) {
134
+ require(['composer/drafts', 'bootbox'], function (drafts, bootbox) {
135
+ const draftsEl = $('[component="sidebar/drafts"]');
136
+
83
137
  function updateBadgeCount() {
84
138
  const count = drafts.getAvailableCount();
139
+ if (count > 0) {
140
+ draftsEl.removeClass('hidden');
141
+ }
85
142
  $('[component="drafts/count"]').toggleClass('hidden', count <= 0).text(count);
86
143
  }
87
144
 
88
145
  async function renderDraftList() {
89
146
  const draftListEl = $('[component="drafts/list"]');
90
- draftListEl.children(':not(.no-drafts)').remove();
91
-
92
147
  const draftItems = drafts.listAvailable();
93
148
  if (!draftItems.length) {
94
149
  draftListEl.find('.no-drafts').removeClass('hidden');
150
+ draftListEl.find('.placeholder-wave').addClass('hidden');
151
+ draftListEl.find('.draft-item-container').html('');
95
152
  return;
96
153
  }
97
154
  draftItems.reverse().forEach((draft) => {
98
155
  if (draft) {
99
- draft.text = draft.text.replace(/(?:\r\n|\r|\n)/g, '<br>');
156
+ draft.text = utils.escapeHTML(
157
+ draft.text
158
+ ).replace(/(?:\r\n|\r|\n)/g, '<br>');
100
159
  }
101
160
  });
102
161
 
103
162
  const html = await app.parseAndTranslate('partials/sidebar/drafts', 'drafts', { drafts: draftItems });
104
163
  draftListEl.find('.no-drafts').addClass('hidden');
105
- draftListEl.append(html).find('.timeago').timeago();
164
+ draftListEl.find('.placeholder-wave').addClass('hidden');
165
+ draftListEl.find('.draft-item-container').html(html).find('.timeago').timeago();
106
166
  }
107
167
 
108
- const draftsEl = $('[component="sidebar/drafts"]');
168
+
109
169
  draftsEl.on('shown.bs.dropdown', renderDraftList);
110
170
 
111
171
  draftsEl.on('click', '[component="drafts/open"]', function () {
@@ -113,8 +173,13 @@ $(document).ready(function () {
113
173
  });
114
174
 
115
175
  draftsEl.on('click', '[component="drafts/delete"]', function () {
116
- drafts.removeDraft($(this).attr('data-save-id'));
117
- renderDraftList();
176
+ const save_id = $(this).attr('data-save-id');
177
+ bootbox.confirm('[[modules:composer.discard-draft-confirm]]', function (ok) {
178
+ if (ok) {
179
+ drafts.removeDraft(save_id);
180
+ renderDraftList();
181
+ }
182
+ });
118
183
  return false;
119
184
  });
120
185
 
@@ -123,6 +188,7 @@ $(document).ready(function () {
123
188
  updateBadgeCount();
124
189
  });
125
190
  }
191
+
126
192
  function setupNProgress() {
127
193
  require(['nprogress'], function (NProgress) {
128
194
  window.nprogress = NProgress;
@@ -137,4 +203,62 @@ $(document).ready(function () {
137
203
  }
138
204
  });
139
205
  }
206
+
207
+ function handleMobileNavigator() {
208
+ const paginationBlockEl = $('.pagination-block');
209
+ require(['hooks'], function (hooks) {
210
+ hooks.on('action:ajaxify.end', function () {
211
+ paginationBlockEl.find('.dropdown-menu.show').removeClass('show');
212
+ });
213
+ hooks.on('filter:navigator.scroll', function (hookData) {
214
+ paginationBlockEl.find('.dropdown-menu.show').removeClass('show');
215
+ return hookData;
216
+ });
217
+ });
218
+ }
219
+
220
+ function setupNavTooltips() {
221
+ // remove title from user icon in sidebar to prevent double tooltip
222
+ $('.sidebar [component="header/avatar"] .avatar').removeAttr('title');
223
+ const tooltipEls = $('.sidebar [title]');
224
+ tooltipEls.tooltip({
225
+ trigger: 'manual',
226
+ animation: false,
227
+ });
228
+
229
+ tooltipEls.on('mouseenter', function (ev) {
230
+ const target = $(ev.target);
231
+ const isDropdown = target.hasClass('dropdown-menu') || !!target.parents('.dropdown-menu').length;
232
+ if (!$('.sidebar').hasClass('open') && !isDropdown) {
233
+ $(this).tooltip('show');
234
+ }
235
+ });
236
+ tooltipEls.on('click mouseleave', function () {
237
+ $(this).tooltip('hide');
238
+ });
239
+ }
240
+
241
+ function fixPlaceholders() {
242
+ if (!config.loggedIn) {
243
+ return;
244
+ }
245
+ ['notifications', 'chat'].forEach((type) => {
246
+ const countEl = document.querySelector(`[component="${type}/count"]`);
247
+ if (!countEl) {
248
+ return;
249
+ }
250
+ const count = parseInt(countEl.innerText, 10);
251
+ if (count > 1) {
252
+ const listEls = document.querySelectorAll(`[component="${type}/list"]`);
253
+ listEls.forEach((listEl) => {
254
+ const placeholder = listEl.querySelector('li');
255
+
256
+ for (let x = 0; x < count - 1; x++) {
257
+ const cloneEl = placeholder.cloneNode(true);
258
+ listEl.insertBefore(cloneEl, placeholder);
259
+ }
260
+ });
261
+ }
262
+ });
263
+ }
140
264
  });
@@ -19,6 +19,7 @@ define('forum/account/theme', ['forum/account/header', 'api', 'settings', 'alert
19
19
  ...themeSettings,
20
20
  },
21
21
  });
22
+ config.theme = (await api.get('/api/config')).theme;
22
23
  alerts.success('[[success:settings-saved]]');
23
24
  });
24
25
  }
Binary file
Binary file
Binary file
package/scss/account.scss CHANGED
@@ -1,4 +1,4 @@
1
- .page-user #panel {
1
+ .page-user.page-status-200 #panel {
2
2
  margin-top: 0px!important;
3
3
  }
4
4
  .account {
package/scss/chats.scss CHANGED
@@ -3,52 +3,107 @@
3
3
  .page-user-chats #content {
4
4
  max-width: 100%;
5
5
  }
6
+
7
+ .stacked-avatars {
8
+ width: 32px;
9
+ height: 32px;
10
+ span:first-child {
11
+ top: 0;
12
+ left: 8px;
13
+ }
14
+ span:last-child {
15
+ left: 0;
16
+ top: 8px;
17
+ }
18
+ }
19
+
6
20
  body.page-user-chats {
7
21
  overflow: hidden;
22
+ [data-widget-area="footer"] {
23
+ display: none;
24
+ }
25
+ height: 100%;
26
+ > .layout-container {
27
+ height: 100%;
28
+ > #panel {
29
+ height: 100%;
30
+ > .container {
31
+ height: 100%;
32
+ }
33
+ }
34
+ }
8
35
  }
9
36
 
10
- .expanded-chat, .chat-modal {
37
+ [component="chat/recent"] {
38
+ .active .chat-room-btn {
39
+ background-color: $btn-ghost-hover-color;
40
+ }
41
+ }
42
+
43
+ [component="chat/nav-wrapper"] {
44
+ width: 300px;
45
+ }
46
+
47
+ .expanded-chat {
11
48
  // no taskbar so hide minimize button
12
49
  [data-action="minimize"] {
13
50
  display: none!important;
14
51
  }
15
- .chat-content .chat-message {
16
- .message-body-wrapper .controls {
17
- [data-action="restore"] {
18
- display: none;
52
+
53
+ .chat-content {
54
+ @include fix-lists;
55
+
56
+ .chat-message {
57
+ .message-body-wrapper .controls {
58
+ [data-action="restore"] {
59
+ display: none;
60
+ }
19
61
  }
20
62
  }
21
- }
22
- .chat-content .chat-message.deleted {
23
- .message-body-wrapper .controls {
24
- [data-action] {
25
- display: none;
26
- }
63
+ .chat-message.deleted {
64
+ .message-body-wrapper .controls {
65
+ [data-action] {
66
+ display: none;
67
+ }
27
68
 
28
- [data-action="restore"] {
29
- display: inline;
69
+ [data-action="restore"] {
70
+ display: inline;
71
+ }
30
72
  }
31
- }
32
73
 
33
- .message-body {
34
- opacity: 0.3;
74
+ .message-body {
75
+ opacity: 0.3;
76
+ }
35
77
  }
36
78
  }
37
79
  }
38
80
 
39
81
  /* Mobile handling of chat page */
82
+ @include media-breakpoint-down(lg) {
83
+ .page-user-chats.chat-loaded {
84
+ padding-bottom: 4.75rem;
85
+ }
86
+ }
87
+
40
88
  @include media-breakpoint-down(md) {
41
- .page-user-chats {
42
- .chats-full {
43
- padding-bottom: 8rem!important;
44
- }
89
+ .page-user-chats.chat-loaded {
90
+ padding-bottom: initial;
91
+ }
92
+ [component="chat/nav-wrapper"] {
93
+ width: 100%;
94
+ }
45
95
 
46
- [component="chat/nav-wrapper"][data-loaded="1"] {
47
- display: none!important;
48
- }
49
96
 
50
- [component="chat/nav-wrapper"][data-loaded="0"] + [component="chat/main-wrapper"] {
51
- display: none!important;
52
- }
97
+ .page-user-chats.chat-loaded .bottombar {
98
+ display: none!important;
99
+ }
100
+
101
+ [component="chat/nav-wrapper"][data-loaded="1"] {
102
+ display: none!important;
53
103
  }
104
+
105
+ [component="chat/nav-wrapper"][data-loaded="0"] + [component="chat/main-wrapper"] {
106
+ display: none!important;
107
+ }
108
+
54
109
  }