nodebb-plugin-calendar-onekite 1.4.2 → 1.4.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-calendar-onekite",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
package/plugin.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "Calendar Onekite",
4
4
  "description": "Calendrier + réservation de matériel + validation admin + paiement HelloAsso pour NodeBB v4",
5
5
  "url": "",
6
- "version": "1.4.2",
6
+ "version": "1.4.4",
7
7
  "library": "./library.js",
8
8
  "staticDirs": {
9
9
  "static": "static"
@@ -14,5 +14,8 @@
14
14
  { "hook": "filter:widgets.getWidgets", "method": "defineWidgets" },
15
15
  { "hook": "filter:widget.render:calendarUpcoming", "method": "renderUpcomingWidget" }
16
16
  ],
17
+ "acpScripts": [
18
+ "static/js/admin.js"
19
+ ],
17
20
  "templates": "templates"
18
21
  }
@@ -23,18 +23,21 @@ define('plugins/nodebb-plugin-calendar-onekite/static/js/admin', [
23
23
  };
24
24
 
25
25
  AdminCalendar.bindSettingsSave = function () {
26
- $('#calendar-onekite-save').off('click').on('click', function () {
27
- const settings = {
28
- allowedGroups: $('#calendar-onekite-groups').val(),
29
- allowedBookingGroups: $('#calendar-onekite-book-groups').val(),
30
- limit: $('#calendar-onekite-widget-limit').val(),
31
- };
32
-
33
- // ✅ RECOMMANDÉ: endpoint standard
34
- api.put('/admin/plugins/calendar-onekite', settings)
35
- .then(() => alerts.success('Paramètres enregistrés'))
36
- .catch(err => alerts.error(err?.message || err));
37
- });
26
+ // évite les doubles binds quand ajaxify recharge la page
27
+ $('#calendar-onekite-save')
28
+ .off('click.calendarOnekite')
29
+ .on('click.calendarOnekite', function () {
30
+ const settings = {
31
+ allowedGroups: $('#calendar-onekite-groups').val(),
32
+ allowedBookingGroups: $('#calendar-onekite-book-groups').val(),
33
+ limit: $('#calendar-onekite-widget-limit').val(),
34
+ };
35
+
36
+ // endpoint standard (doit exister côté serveur)
37
+ api.put('/admin/plugins/calendar-onekite', settings)
38
+ .then(() => alerts.success('Paramètres enregistrés'))
39
+ .catch(err => alerts.error(err?.message || err));
40
+ });
38
41
  };
39
42
 
40
43
  AdminCalendar.loadPending = function () {
@@ -155,5 +158,15 @@ define('plugins/nodebb-plugin-calendar-onekite/static/js/admin', [
155
158
  .catch(err => alerts.error(err?.message || err));
156
159
  };
157
160
 
161
+ // ✅ essentiel : relance l’init à chaque navigation ACP ajaxify
162
+ $(window).on('action:ajaxify.end', function () {
163
+ AdminCalendar.init();
164
+ });
165
+
166
+ // et au chargement initial
167
+ $(function () {
168
+ AdminCalendar.init();
169
+ });
170
+
158
171
  return AdminCalendar;
159
172
  });
@@ -26,10 +26,4 @@
26
26
  </div>
27
27
 
28
28
  <button id="calendar-onekite-save" class="btn btn-primary">Enregistrer</button>
29
- </div>
30
-
31
- <script>
32
- require(['plugins/nodebb-plugin-calendar-onekite/static/js/admin'], function (Admin) {
33
- Admin.init();
34
- });
35
- </script>
29
+ </div>