nodebb-plugin-equipment-calendar 0.3.0 → 0.3.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.
package/library.js CHANGED
@@ -402,6 +402,7 @@ async function renderAdminPage(req, res) {
402
402
  res.render('admin/plugins/equipment-calendar', {
403
403
  title: 'Equipment Calendar',
404
404
  settings,
405
+ saved: req.query && String(req.query.saved || '') === '1',
405
406
  view_dayGridMonth: (settings.defaultView || 'dayGridMonth') === 'dayGridMonth',
406
407
  view_timeGridWeek: (settings.defaultView || '') === 'timeGridWeek',
407
408
  view_timeGridDay: (settings.defaultView || '') === 'timeGridDay',
@@ -708,7 +709,7 @@ async function handleAdminSave(req, res) {
708
709
  };
709
710
 
710
711
  await meta.settings.set(SETTINGS_KEY, values);
711
- return res.redirect('/admin/plugins/equipment-calendar');
712
+ return res.redirect('/admin/plugins/equipment-calendar?saved=1');
712
713
  } catch (e) {
713
714
  return res.status(500).send(e.message || 'error');
714
715
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-equipment-calendar",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Equipment reservation calendar for NodeBB (FullCalendar, approvals, HelloAsso payments)",
5
5
  "main": "library.js",
6
6
  "scripts": {
package/plugin.json CHANGED
@@ -26,6 +26,6 @@
26
26
  "scripts": [
27
27
  "public/js/client.js"
28
28
  ],
29
- "version": "0.2.2",
29
+ "version": "0.2.4",
30
30
  "minver": "4.7.1"
31
31
  }
@@ -75,8 +75,17 @@
75
75
  // show modal
76
76
  const modalEl = document.getElementById('ecReserveModal');
77
77
  if (!modalEl) return;
78
- const modal = bootstrap ? bootstrap.Modal.getOrCreateInstance(modalEl) : null;
79
- if (modal) modal.show();
78
+ if (typeof bootstrap !== 'undefined' && bootstrap.Modal) {
79
+ const modal = bootstrap.Modal.getOrCreateInstance(modalEl);
80
+ modal.show();
81
+ } else {
82
+ // Fallback: no bootstrap JS available, just submit directly if there is an available item
83
+ if (hasAny) {
84
+ if (confirm('Envoyer la demande de réservation pour cette plage ?')) {
85
+ form.submit();
86
+ }
87
+ }
88
+ }
80
89
  }
81
90
 
82
91
  function initCalendar() {
@@ -1,7 +1,21 @@
1
1
  <div class="acp-page-container">
2
2
  <h1>Equipment Calendar</h1>
3
3
 
4
- <form method="post" action="/admin/plugins/equipment-calendar/save" class="mb-3">
4
+ {{{ if saved }}}
5
+ <div class="alert alert-success">Paramètres enregistrés.</div>
6
+ <script>
7
+ (function () {
8
+ try {
9
+ if (window.app && window.app.alertSuccess) {
10
+ window.app.alertSuccess('Paramètres enregistrés');
11
+ }
12
+ } catch (e) {}
13
+ }());
14
+ </script>
15
+ {{{ end }}}
16
+
17
+
18
+ <form id="ec-admin-form" method="post" action="/admin/plugins/equipment-calendar/save" class="mb-3">
5
19
  <input type="hidden" name="_csrf" value="{config.csrf_token}">
6
20
 
7
21
  <div class="alert alert-warning">
@@ -60,6 +74,25 @@
60
74
  <div class="mb-3"><label class="form-label">Timezone</label><input name="timezone" class="form-control" value="{settings.timezone}"></div>
61
75
  </div>
62
76
 
63
- <button class="btn btn-primary" type="submit">Sauvegarder</button>
77
+ <button id="ec-save" class="btn btn-primary" type="button">Sauvegarder</button>
64
78
  </form>
65
79
  </div>
80
+
81
+ <script>
82
+ (function () {
83
+ function ready(fn){ if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', fn); else fn(); }
84
+ ready(function () {
85
+ var btn = document.getElementById('ec-save');
86
+ var form = document.getElementById('ec-admin-form');
87
+ if (!btn || !form) { return; }
88
+ btn.addEventListener('click', function () {
89
+ try {
90
+ form.submit();
91
+ } catch (e) {
92
+ console.error(e);
93
+ alert('Erreur lors de la soumission du formulaire (voir console).');
94
+ }
95
+ });
96
+ });
97
+ }());
98
+ </script>
@@ -61,7 +61,7 @@
61
61
  </div>
62
62
  </div>
63
63
 
64
- <script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/6.1.19/index.global.min.js"></script>
64
+ <script src="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.19/index.global.min.js"></script>
65
65
  <script src="/plugins/nodebb-plugin-equipment-calendar/js/client.js"></script>
66
66
 
67
67
  <script>