nodebb-plugin-calendar-onekite 11.2.31 → 11.2.38
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/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/plugin.json +1 -2
- package/public/admin.js +24 -3
- package/public/client.js +8 -2
- package/templates/admin/plugins/calendar-onekite.tpl +8 -5
- package/templates/calendar-onekite.tpl +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
|
|
2
|
+
## 1.0.2
|
|
3
|
+
- Front : empêche la double initialisation du calendrier (évite le clignotement au chargement / après actions).
|
|
4
|
+
- ACP (NodeBB v4) : init robuste via `hooks.on('action:ajaxify.end')` + garde-fou anti double-bind (évite les multi-popups).
|
|
5
|
+
- Maintenance : suppression du mapping module ACP legacy (`../admin/plugins/...`).
|
|
6
|
+
|
|
2
7
|
## 1.0.1.1
|
|
3
8
|
- ACP (NodeBB v4) : empêche l’affichage multiple des popups de succès lors de l’enregistrement (déduplication des alerts).
|
|
4
9
|
|
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
},
|
|
23
23
|
"templates": "./templates",
|
|
24
24
|
"modules": {
|
|
25
|
-
"../admin/plugins/calendar-onekite.js": "./public/admin.js",
|
|
26
25
|
"admin/plugins/calendar-onekite": "./public/admin.js"
|
|
27
26
|
},
|
|
28
27
|
"scripts": [
|
|
@@ -31,5 +30,5 @@
|
|
|
31
30
|
"acpScripts": [
|
|
32
31
|
"public/admin.js"
|
|
33
32
|
],
|
|
34
|
-
"version": "1.0.
|
|
33
|
+
"version": "1.0.2"
|
|
35
34
|
}
|
package/public/admin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
define('admin/plugins/calendar-onekite', ['alerts', 'bootbox'], function (alerts, bootbox) {
|
|
2
|
+
define('admin/plugins/calendar-onekite', ['alerts', 'bootbox', 'hooks'], function (alerts, bootbox, hooks) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
// Cache of pending reservations keyed by rid so delegated click handlers
|
|
@@ -91,7 +91,7 @@ define('admin/plugins/calendar-onekite', ['alerts', 'bootbox'], function (alerts
|
|
|
91
91
|
const link = document.createElement('link');
|
|
92
92
|
link.id = cssId;
|
|
93
93
|
link.rel = 'stylesheet';
|
|
94
|
-
link.href = 'https://
|
|
94
|
+
link.href = 'https://cdn.jsdelivr.net/npm/leaflet@latest/dist/leaflet.css';
|
|
95
95
|
document.head.appendChild(link);
|
|
96
96
|
}
|
|
97
97
|
const existing = document.getElementById(jsId);
|
|
@@ -103,7 +103,7 @@ define('admin/plugins/calendar-onekite', ['alerts', 'bootbox'], function (alerts
|
|
|
103
103
|
const script = document.createElement('script');
|
|
104
104
|
script.id = jsId;
|
|
105
105
|
script.async = true;
|
|
106
|
-
script.src = 'https://
|
|
106
|
+
script.src = 'https://cdn.jsdelivr.net/npm/leaflet@latest/dist/leaflet.js';
|
|
107
107
|
script.onload = () => resolve(window.L);
|
|
108
108
|
script.onerror = () => reject(new Error('leaflet-load-failed'));
|
|
109
109
|
document.head.appendChild(script);
|
|
@@ -335,6 +335,12 @@ define('admin/plugins/calendar-onekite', ['alerts', 'bootbox'], function (alerts
|
|
|
335
335
|
const form = document.getElementById('onekite-settings-form');
|
|
336
336
|
if (!form) return;
|
|
337
337
|
|
|
338
|
+
// Avoid duplicate listeners/toasts when revisiting the ACP page via ajaxify.
|
|
339
|
+
if (form.getAttribute('data-onekite-bound') === '1') {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
form.setAttribute('data-onekite-bound', '1');
|
|
343
|
+
|
|
338
344
|
// Make the HelloAsso debug output readable in both light and dark ACP themes.
|
|
339
345
|
// NodeBB 4.x uses Bootstrap variables, so we can rely on CSS variables here.
|
|
340
346
|
(function injectAdminCss() {
|
|
@@ -801,5 +807,20 @@ define('admin/plugins/calendar-onekite', ['alerts', 'bootbox'], function (alerts
|
|
|
801
807
|
}
|
|
802
808
|
}
|
|
803
809
|
|
|
810
|
+
// Auto-init when navigating in ACP via ajaxify.
|
|
811
|
+
try {
|
|
812
|
+
const autoInit = function (data) {
|
|
813
|
+
const tpl = data && data.template ? data.template.name : (window.ajaxify && ajaxify.data && ajaxify.data.template ? ajaxify.data.template.name : '');
|
|
814
|
+
if (tpl === 'admin/plugins/calendar-onekite') {
|
|
815
|
+
init();
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
if (hooks && typeof hooks.on === 'function') {
|
|
819
|
+
hooks.on('action:ajaxify.end', autoInit);
|
|
820
|
+
}
|
|
821
|
+
// Also try once for the initial render.
|
|
822
|
+
setTimeout(() => autoInit({ template: (window.ajaxify && ajaxify.data && ajaxify.data.template) || { name: '' } }), 0);
|
|
823
|
+
} catch (e) {}
|
|
824
|
+
|
|
804
825
|
return { init };
|
|
805
826
|
});
|
package/public/client.js
CHANGED
|
@@ -456,7 +456,7 @@ define('forum/calendar-onekite', ['alerts', 'bootbox', 'hooks'], function (alert
|
|
|
456
456
|
const link = document.createElement('link');
|
|
457
457
|
link.id = cssId;
|
|
458
458
|
link.rel = 'stylesheet';
|
|
459
|
-
link.href = 'https://
|
|
459
|
+
link.href = 'https://cdn.jsdelivr.net/npm/leaflet@latest/dist/leaflet.css';
|
|
460
460
|
document.head.appendChild(link);
|
|
461
461
|
}
|
|
462
462
|
|
|
@@ -470,7 +470,7 @@ define('forum/calendar-onekite', ['alerts', 'bootbox', 'hooks'], function (alert
|
|
|
470
470
|
const script = document.createElement('script');
|
|
471
471
|
script.id = jsId;
|
|
472
472
|
script.async = true;
|
|
473
|
-
script.src = 'https://
|
|
473
|
+
script.src = 'https://cdn.jsdelivr.net/npm/leaflet@latest/dist/leaflet.js';
|
|
474
474
|
script.onload = () => resolve(window.L);
|
|
475
475
|
script.onerror = () => reject(new Error('leaflet-load-failed'));
|
|
476
476
|
document.head.appendChild(script);
|
|
@@ -828,6 +828,12 @@ function toDatetimeLocalValue(date) {
|
|
|
828
828
|
return;
|
|
829
829
|
}
|
|
830
830
|
|
|
831
|
+
// Avoid double init (ajaxify + initial load tick).
|
|
832
|
+
if (el.getAttribute('data-onekite-initialised') === '1') {
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
el.setAttribute('data-onekite-initialised', '1');
|
|
836
|
+
|
|
831
837
|
if (typeof FullCalendar === 'undefined') {
|
|
832
838
|
showAlert('error', 'FullCalendar non chargé');
|
|
833
839
|
return;
|
|
@@ -180,11 +180,14 @@
|
|
|
180
180
|
</div>
|
|
181
181
|
|
|
182
182
|
<script>
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
// NodeBB v4: prefer auto-init via ajaxify hook, but keep a safe fallback.
|
|
184
|
+
if (window.require) {
|
|
185
|
+
require(['admin/plugins/calendar-onekite'], function (mod) {
|
|
186
|
+
if (mod && mod.init) {
|
|
187
|
+
mod.init();
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
188
191
|
</script>
|
|
189
192
|
|
|
190
193
|
<!-- IMPORT admin/partials/settings/footer.tpl -->
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
</div>
|
|
8
8
|
</div>
|
|
9
9
|
|
|
10
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fullcalendar@
|
|
11
|
-
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@
|
|
12
|
-
<script src="https://cdn.jsdelivr.net/npm
|
|
10
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fullcalendar@latest/index.global.min.css" />
|
|
11
|
+
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@latest/index.global.min.js"></script>
|
|
12
|
+
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@latest/locales-all.global.min.js"></script>
|
|
13
13
|
|
|
14
14
|
<!--
|
|
15
15
|
No inline require() here.
|