@okjavis/nodebb-theme-javis 2.5.1 → 2.5.2
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/package.json +1 -1
- package/plugin.json +6 -1
- package/templates/admin/plugins/javis.tpl +76 -0
- package/theme.js +40 -5
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
"library": "./theme.js",
|
|
7
7
|
"baseTheme": "nodebb-theme-harmony",
|
|
8
8
|
"hooks": [
|
|
9
|
+
{ "hook": "static:app.load", "method": "init" },
|
|
9
10
|
{ "hook": "filter:widgets.getAreas", "method": "defineWidgetAreas" },
|
|
10
11
|
{ "hook": "filter:admin.header.build", "method": "addAdminNavigation" },
|
|
11
|
-
{ "hook": "filter:config.get", "method": "getThemeConfig" }
|
|
12
|
+
{ "hook": "filter:config.get", "method": "getThemeConfig" },
|
|
13
|
+
{ "hook": "filter:settings.get", "method": "getAdminSettings" }
|
|
12
14
|
],
|
|
13
15
|
"staticDirs": {
|
|
14
16
|
"static": "./static"
|
|
@@ -16,6 +18,9 @@
|
|
|
16
18
|
"scripts": [
|
|
17
19
|
"static/lib/theme.js"
|
|
18
20
|
],
|
|
21
|
+
"modules": {
|
|
22
|
+
"../admin/plugins/javis.js": "public/admin.js"
|
|
23
|
+
},
|
|
19
24
|
"templates": "templates",
|
|
20
25
|
"screenshot": "screenshot.png",
|
|
21
26
|
"version": "1.5.0",
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<div class="acp-page-container">
|
|
2
|
+
<!-- IMPORT admin/partials/settings/header.tpl -->
|
|
3
|
+
|
|
4
|
+
<div class="row m-0">
|
|
5
|
+
<div id="spy-container" class="col-12 col-md-8 px-0 mb-4" tabindex="0">
|
|
6
|
+
<form role="form" class="javis-settings">
|
|
7
|
+
<div class="mb-4">
|
|
8
|
+
<h5 class="fw-bold">JAVIS Theme Settings</h5>
|
|
9
|
+
<p class="text-muted">Configure the default settings for the JAVIS Community theme.</p>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<div class="form-check form-switch mb-3">
|
|
13
|
+
<input type="checkbox" class="form-check-input" id="enableQuickReply" name="enableQuickReply" />
|
|
14
|
+
<label for="enableQuickReply" class="form-check-label">Enable Quick Reply</label>
|
|
15
|
+
<p class="form-text">Allow users to quickly reply to topics without opening the full composer.</p>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="form-check form-switch mb-3">
|
|
19
|
+
<input type="checkbox" class="form-check-input" id="enableBreadcrumbs" name="enableBreadcrumbs" />
|
|
20
|
+
<label for="enableBreadcrumbs" class="form-check-label">Enable Breadcrumbs</label>
|
|
21
|
+
<p class="form-text">Show navigation breadcrumbs at the top of pages.</p>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div class="form-check form-switch mb-3">
|
|
25
|
+
<input type="checkbox" class="form-check-input" id="centerHeaderElements" name="centerHeaderElements" />
|
|
26
|
+
<label for="centerHeaderElements" class="form-check-label">Center Header Elements</label>
|
|
27
|
+
<p class="form-text">Center-align the header navigation elements.</p>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div class="form-check form-switch mb-3">
|
|
31
|
+
<input type="checkbox" class="form-check-input" id="mobileTopicTeasers" name="mobileTopicTeasers" />
|
|
32
|
+
<label for="mobileTopicTeasers" class="form-check-label">Mobile Topic Teasers</label>
|
|
33
|
+
<p class="form-text">Show topic teasers on mobile devices.</p>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div class="form-check form-switch mb-3">
|
|
37
|
+
<input type="checkbox" class="form-check-input" id="stickyToolbar" name="stickyToolbar" />
|
|
38
|
+
<label for="stickyToolbar" class="form-check-label">Sticky Toolbar</label>
|
|
39
|
+
<p class="form-text">Keep the topic toolbar visible when scrolling.</p>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div class="form-check form-switch mb-3">
|
|
43
|
+
<input type="checkbox" class="form-check-input" id="topicSidebarTools" name="topicSidebarTools" />
|
|
44
|
+
<label for="topicSidebarTools" class="form-check-label">Topic Sidebar Tools</label>
|
|
45
|
+
<p class="form-text">Show topic tools in the sidebar instead of inline.</p>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div class="form-check form-switch mb-3">
|
|
49
|
+
<input type="checkbox" class="form-check-input" id="autohideBottombar" name="autohideBottombar" />
|
|
50
|
+
<label for="autohideBottombar" class="form-check-label">Auto-hide Bottom Bar</label>
|
|
51
|
+
<p class="form-text">Automatically hide the bottom navigation bar when scrolling down.</p>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div class="form-check form-switch mb-3">
|
|
55
|
+
<input type="checkbox" class="form-check-input" id="topMobilebar" name="topMobilebar" />
|
|
56
|
+
<label for="topMobilebar" class="form-check-label">Top Mobile Bar</label>
|
|
57
|
+
<p class="form-text">Show mobile navigation at the top instead of bottom.</p>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<div class="form-check form-switch mb-3">
|
|
61
|
+
<input type="checkbox" class="form-check-input" id="openSidebars" name="openSidebars" />
|
|
62
|
+
<label for="openSidebars" class="form-check-label">Open Sidebars by Default</label>
|
|
63
|
+
<p class="form-text">Keep sidebars expanded by default (JAVIS default: enabled).</p>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<div class="form-check form-switch mb-3">
|
|
67
|
+
<input type="checkbox" class="form-check-input" id="chatModals" name="chatModals" />
|
|
68
|
+
<label for="chatModals" class="form-check-label">Chat Modals</label>
|
|
69
|
+
<p class="form-text">Open chats in modal windows instead of navigating to the chat page.</p>
|
|
70
|
+
</div>
|
|
71
|
+
</form>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<!-- IMPORT admin/partials/settings/toc.tpl -->
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
package/theme.js
CHANGED
|
@@ -9,9 +9,11 @@ const meta = require.main.require('./src/meta');
|
|
|
9
9
|
const user = require.main.require('./src/user');
|
|
10
10
|
const _ = require.main.require('lodash');
|
|
11
11
|
|
|
12
|
+
const controllers = require('./lib/controllers');
|
|
13
|
+
|
|
12
14
|
const theme = {};
|
|
13
15
|
|
|
14
|
-
//
|
|
16
|
+
// JAVIS defaults - openSidebars is 'on' by default
|
|
15
17
|
const defaults = {
|
|
16
18
|
enableQuickReply: 'on',
|
|
17
19
|
enableBreadcrumbs: 'on',
|
|
@@ -26,15 +28,31 @@ const defaults = {
|
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
/**
|
|
29
|
-
*
|
|
31
|
+
* Hook: static:app.load
|
|
32
|
+
* Initialize routes for admin panel
|
|
33
|
+
*/
|
|
34
|
+
theme.init = async function (params) {
|
|
35
|
+
const { router } = params;
|
|
36
|
+
const routeHelpers = require.main.require('./src/routes/helpers');
|
|
37
|
+
|
|
38
|
+
// Admin panel route
|
|
39
|
+
routeHelpers.setupAdminPageRoute(router, '/admin/plugins/javis', [], controllers.renderAdminPage);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Load theme config
|
|
30
44
|
* Uses JAVIS defaults (with openSidebars: 'on')
|
|
31
45
|
*/
|
|
32
46
|
async function loadThemeConfig(uid) {
|
|
33
|
-
const [
|
|
34
|
-
meta.settings.get('harmony'),
|
|
47
|
+
const [harmonyConfig, javisConfig, userConfig] = await Promise.all([
|
|
48
|
+
meta.settings.get('harmony'), // Read from Harmony's settings (parent theme)
|
|
49
|
+
meta.settings.get('javis'), // Read from JAVIS-specific settings
|
|
35
50
|
user.getSettings(uid),
|
|
36
51
|
]);
|
|
37
52
|
|
|
53
|
+
// Merge: Harmony settings first, then JAVIS overrides
|
|
54
|
+
const themeConfig = { ...harmonyConfig, ...javisConfig };
|
|
55
|
+
|
|
38
56
|
// 3-tier cascade: JAVIS defaults -> theme settings -> user settings
|
|
39
57
|
const config = { ...defaults, ...themeConfig, ...(_.pick(userConfig, Object.keys(defaults))) };
|
|
40
58
|
|
|
@@ -53,6 +71,9 @@ async function loadThemeConfig(uid) {
|
|
|
53
71
|
return config;
|
|
54
72
|
}
|
|
55
73
|
|
|
74
|
+
// Export loadThemeConfig for potential use by other modules
|
|
75
|
+
theme.loadThemeConfig = loadThemeConfig;
|
|
76
|
+
|
|
56
77
|
/**
|
|
57
78
|
* Hook: filter:config.get
|
|
58
79
|
* Sets config.theme with JAVIS-specific defaults
|
|
@@ -63,6 +84,20 @@ theme.getThemeConfig = async function (config) {
|
|
|
63
84
|
return config;
|
|
64
85
|
};
|
|
65
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Hook: filter:settings.get
|
|
89
|
+
* Provide default values for admin settings
|
|
90
|
+
*/
|
|
91
|
+
theme.getAdminSettings = async function (hookData) {
|
|
92
|
+
if (hookData.plugin === 'javis') {
|
|
93
|
+
hookData.values = {
|
|
94
|
+
...defaults,
|
|
95
|
+
...hookData.values,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return hookData;
|
|
99
|
+
};
|
|
100
|
+
|
|
66
101
|
theme.defineWidgetAreas = async (areas) => {
|
|
67
102
|
// Define widget areas like Harmony does
|
|
68
103
|
const locations = ['header', 'sidebar', 'footer'];
|
|
@@ -125,7 +160,7 @@ theme.defineWidgetAreas = async (areas) => {
|
|
|
125
160
|
|
|
126
161
|
theme.addAdminNavigation = (header) => {
|
|
127
162
|
header.plugins.push({
|
|
128
|
-
route: '/plugins/javis
|
|
163
|
+
route: '/plugins/javis',
|
|
129
164
|
icon: 'fa-paint-brush',
|
|
130
165
|
name: 'JAVIS Theme',
|
|
131
166
|
});
|