nodebb-plugin-onekite-calendar 2.0.59 → 2.0.60

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-onekite-calendar",
3
- "version": "2.0.59",
3
+ "version": "2.0.60",
4
4
  "description": "FullCalendar-based equipment reservation workflow with admin approval & HelloAsso payment for NodeBB",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/plugin.json CHANGED
@@ -39,5 +39,5 @@
39
39
  "acpScripts": [
40
40
  "public/admin.js"
41
41
  ],
42
- "version": "2.0.59"
42
+ "version": "2.0.60"
43
43
  }
package/public/client.js CHANGED
@@ -1738,60 +1738,63 @@ function toDatetimeLocalValue(date) {
1738
1738
  } : {}),
1739
1739
  },
1740
1740
  });
1741
- // Self-join handler
1741
+ // Self-join handler (event delegation so it keeps working after DOM updates)
1742
1742
  try {
1743
- dlg.on('shown.bs.modal', () => {
1744
- dlg.find('.onekite-join-special').off('click').on('click', async (e2) => {
1745
- e2.preventDefault();
1746
- const btn = e2.currentTarget;
1747
- if (!btn) return;
1748
- try {
1749
- btn.classList.add('disabled');
1750
- const eid = String(btn.getAttribute('data-eid') || '').trim();
1751
- if (!eid) return;
1752
- const r = await fetchJson(`/api/v3/plugins/calendar-onekite/special-events/${encodeURIComponent(eid)}/participants`, { method: 'POST' });
1753
- const names = Array.isArray(r && r.participantsUsernames) ? r.participantsUsernames : [];
1754
- const box = dlg.find('#onekite-participants-special');
1755
- if (box && box.length) {
1756
- const links = names.length
1757
- ? names.map((name) => {
1758
- const u = String(name || '').trim();
1759
- if (!u) return '';
1760
- return `<a class="onekite-user-link me-2" href="${window.location.origin}/user/${encodeURIComponent(u)}">${escapeHtml(u)}</a>`;
1761
- }).filter(Boolean).join('')
1762
- : `<span class="text-muted">Aucun</span>`;
1763
- box.html(`<strong>Participants</strong><button type="button" class="btn btn-sm btn-danger ms-2 onekite-leave-special" data-eid="${escapeHtml(eid)}" title="Se retirer" aria-label="Se retirer">−</button><br>${links}`);
1764
- }
1765
- } catch (e3) {
1766
- showAlert('error', "Impossible de s'ajouter.");
1743
+ dlg.off('click.onekiteParticipants');
1744
+ dlg.on('click.onekiteParticipants', '.onekite-join-special', async (e2) => {
1745
+ e2.preventDefault();
1746
+ const btn = e2.currentTarget;
1747
+ if (!btn) return;
1748
+ try {
1749
+ btn.classList.add('disabled');
1750
+ const eid = String(btn.getAttribute('data-eid') || '').trim();
1751
+ if (!eid) return;
1752
+ const r = await fetchJson(`/api/v3/plugins/calendar-onekite/special-events/${encodeURIComponent(eid)}/participants`, { method: 'POST' });
1753
+ const names = Array.isArray(r && r.participantsUsernames) ? r.participantsUsernames : [];
1754
+ const box = dlg.find('#onekite-participants-special');
1755
+ if (box && box.length) {
1756
+ const links = names.length
1757
+ ? names.map((name) => {
1758
+ const u = String(name || '').trim();
1759
+ if (!u) return '';
1760
+ return `<a class="onekite-user-link me-2" href="${window.location.origin}/user/${encodeURIComponent(u)}">${escapeHtml(u)}</a>`;
1761
+ }).filter(Boolean).join('')
1762
+ : `<span class="text-muted">Aucun</span>`;
1763
+ box.html(`<strong>Participants</strong><button type="button" class="btn btn-sm btn-danger ms-2 onekite-leave-special" data-eid="${escapeHtml(eid)}" title="Se retirer" aria-label="Se retirer">−</button><br>${links}`);
1767
1764
  }
1768
- });
1765
+ } catch (e3) {
1766
+ showAlert('error', "Impossible de s'ajouter.");
1767
+ } finally {
1768
+ try { btn.classList.remove('disabled'); } catch (e4) {}
1769
+ }
1770
+ });
1769
1771
 
1770
- dlg.find('.onekite-leave-special').off('click').on('click', async (e2) => {
1771
- e2.preventDefault();
1772
- const btn = e2.currentTarget;
1773
- if (!btn) return;
1774
- try {
1775
- btn.classList.add('disabled');
1776
- const eid = String(btn.getAttribute('data-eid') || '').trim();
1777
- if (!eid) return;
1778
- const r = await fetchJson(`/api/v3/plugins/calendar-onekite/special-events/${encodeURIComponent(eid)}/participants`, { method: 'DELETE' });
1779
- const names = Array.isArray(r && r.participantsUsernames) ? r.participantsUsernames : [];
1780
- const box = dlg.find('#onekite-participants-special');
1781
- if (box && box.length) {
1782
- const links = names.length
1783
- ? names.map((name) => {
1784
- const u = String(name || '').trim();
1785
- if (!u) return '';
1786
- return `<a class="onekite-user-link me-2" href="${window.location.origin}/user/${encodeURIComponent(u)}">${escapeHtml(u)}</a>`;
1787
- }).filter(Boolean).join('')
1788
- : `<span class="text-muted">Aucun</span>`;
1789
- box.html(`<strong>Participants</strong><button type="button" class="btn btn-sm btn-success ms-2 onekite-join-special" data-eid="${escapeHtml(eid)}" title="S'ajouter" aria-label="S'ajouter">+</button><br>${links}`);
1790
- }
1791
- } catch (e3) {
1792
- showAlert('error', "Impossible de se retirer.");
1772
+ dlg.on('click.onekiteParticipants', '.onekite-leave-special', async (e2) => {
1773
+ e2.preventDefault();
1774
+ const btn = e2.currentTarget;
1775
+ if (!btn) return;
1776
+ try {
1777
+ btn.classList.add('disabled');
1778
+ const eid = String(btn.getAttribute('data-eid') || '').trim();
1779
+ if (!eid) return;
1780
+ const r = await fetchJson(`/api/v3/plugins/calendar-onekite/special-events/${encodeURIComponent(eid)}/participants`, { method: 'DELETE' });
1781
+ const names = Array.isArray(r && r.participantsUsernames) ? r.participantsUsernames : [];
1782
+ const box = dlg.find('#onekite-participants-special');
1783
+ if (box && box.length) {
1784
+ const links = names.length
1785
+ ? names.map((name) => {
1786
+ const u = String(name || '').trim();
1787
+ if (!u) return '';
1788
+ return `<a class="onekite-user-link me-2" href="${window.location.origin}/user/${encodeURIComponent(u)}">${escapeHtml(u)}</a>`;
1789
+ }).filter(Boolean).join('')
1790
+ : `<span class="text-muted">Aucun</span>`;
1791
+ box.html(`<strong>Participants</strong><button type="button" class="btn btn-sm btn-success ms-2 onekite-join-special" data-eid="${escapeHtml(eid)}" title="S'ajouter" aria-label="S'ajouter">+</button><br>${links}`);
1793
1792
  }
1794
- });
1793
+ } catch (e3) {
1794
+ showAlert('error', "Impossible de se retirer.");
1795
+ } finally {
1796
+ try { btn.classList.remove('disabled'); } catch (e4) {}
1797
+ }
1795
1798
  });
1796
1799
  } catch (e) {}
1797
1800
  try {
@@ -1877,60 +1880,63 @@ function toDatetimeLocalValue(date) {
1877
1880
  } : {}),
1878
1881
  },
1879
1882
  });
1880
- // Self-join handler
1883
+ // Self-join handler (event delegation so it keeps working after DOM updates)
1881
1884
  try {
1882
- dlg.on('shown.bs.modal', () => {
1883
- dlg.find('.onekite-join-outing').off('click').on('click', async (e2) => {
1884
- e2.preventDefault();
1885
- const btn = e2.currentTarget;
1886
- if (!btn) return;
1887
- try {
1888
- btn.classList.add('disabled');
1889
- const oid = String(btn.getAttribute('data-oid') || '').trim();
1890
- if (!oid) return;
1891
- const r = await fetchJson(`/api/v3/plugins/calendar-onekite/outings/${encodeURIComponent(oid)}/participants`, { method: 'POST' });
1892
- const names = Array.isArray(r && r.participantsUsernames) ? r.participantsUsernames : [];
1893
- const box = dlg.find('#onekite-participants-outing');
1894
- if (box && box.length) {
1895
- const links = names.length
1896
- ? names.map((name) => {
1897
- const u = String(name || '').trim();
1898
- if (!u) return '';
1899
- return `<a class="onekite-user-link me-2" href="${window.location.origin}/user/${encodeURIComponent(u)}">${escapeHtml(u)}</a>`;
1900
- }).filter(Boolean).join('')
1901
- : `<span class="text-muted">Aucun</span>`;
1902
- box.html(`<strong>Participants</strong><button type="button" class="btn btn-sm btn-danger ms-2 onekite-leave-outing" data-oid="${escapeHtml(oid)}" title="Se retirer" aria-label="Se retirer">−</button><br>${links}`);
1903
- }
1904
- } catch (e3) {
1905
- showAlert('error', "Impossible de s'ajouter.");
1885
+ dlg.off('click.onekiteParticipantsOuting');
1886
+ dlg.on('click.onekiteParticipantsOuting', '.onekite-join-outing', async (e2) => {
1887
+ e2.preventDefault();
1888
+ const btn = e2.currentTarget;
1889
+ if (!btn) return;
1890
+ try {
1891
+ btn.classList.add('disabled');
1892
+ const oid = String(btn.getAttribute('data-oid') || '').trim();
1893
+ if (!oid) return;
1894
+ const r = await fetchJson(`/api/v3/plugins/calendar-onekite/outings/${encodeURIComponent(oid)}/participants`, { method: 'POST' });
1895
+ const names = Array.isArray(r && r.participantsUsernames) ? r.participantsUsernames : [];
1896
+ const box = dlg.find('#onekite-participants-outing');
1897
+ if (box && box.length) {
1898
+ const links = names.length
1899
+ ? names.map((name) => {
1900
+ const u = String(name || '').trim();
1901
+ if (!u) return '';
1902
+ return `<a class="onekite-user-link me-2" href="${window.location.origin}/user/${encodeURIComponent(u)}">${escapeHtml(u)}</a>`;
1903
+ }).filter(Boolean).join('')
1904
+ : `<span class="text-muted">Aucun</span>`;
1905
+ box.html(`<strong>Participants</strong><button type="button" class="btn btn-sm btn-danger ms-2 onekite-leave-outing" data-oid="${escapeHtml(oid)}" title="Se retirer" aria-label="Se retirer">−</button><br>${links}`);
1906
1906
  }
1907
- });
1907
+ } catch (e3) {
1908
+ showAlert('error', "Impossible de s'ajouter.");
1909
+ } finally {
1910
+ try { btn.classList.remove('disabled'); } catch (e4) {}
1911
+ }
1912
+ });
1908
1913
 
1909
- dlg.find('.onekite-leave-outing').off('click').on('click', async (e2) => {
1910
- e2.preventDefault();
1911
- const btn = e2.currentTarget;
1912
- if (!btn) return;
1913
- try {
1914
- btn.classList.add('disabled');
1915
- const oid = String(btn.getAttribute('data-oid') || '').trim();
1916
- if (!oid) return;
1917
- const r = await fetchJson(`/api/v3/plugins/calendar-onekite/outings/${encodeURIComponent(oid)}/participants`, { method: 'DELETE' });
1918
- const names = Array.isArray(r && r.participantsUsernames) ? r.participantsUsernames : [];
1919
- const box = dlg.find('#onekite-participants-outing');
1920
- if (box && box.length) {
1921
- const links = names.length
1922
- ? names.map((name) => {
1923
- const u = String(name || '').trim();
1924
- if (!u) return '';
1925
- return `<a class="onekite-user-link me-2" href="${window.location.origin}/user/${encodeURIComponent(u)}">${escapeHtml(u)}</a>`;
1926
- }).filter(Boolean).join('')
1927
- : `<span class="text-muted">Aucun</span>`;
1928
- box.html(`<strong>Participants</strong><button type="button" class="btn btn-sm btn-success ms-2 onekite-join-outing" data-oid="${escapeHtml(oid)}" title="S'ajouter" aria-label="S'ajouter">+</button><br>${links}`);
1929
- }
1930
- } catch (e3) {
1931
- showAlert('error', "Impossible de se retirer.");
1914
+ dlg.on('click.onekiteParticipantsOuting', '.onekite-leave-outing', async (e2) => {
1915
+ e2.preventDefault();
1916
+ const btn = e2.currentTarget;
1917
+ if (!btn) return;
1918
+ try {
1919
+ btn.classList.add('disabled');
1920
+ const oid = String(btn.getAttribute('data-oid') || '').trim();
1921
+ if (!oid) return;
1922
+ const r = await fetchJson(`/api/v3/plugins/calendar-onekite/outings/${encodeURIComponent(oid)}/participants`, { method: 'DELETE' });
1923
+ const names = Array.isArray(r && r.participantsUsernames) ? r.participantsUsernames : [];
1924
+ const box = dlg.find('#onekite-participants-outing');
1925
+ if (box && box.length) {
1926
+ const links = names.length
1927
+ ? names.map((name) => {
1928
+ const u = String(name || '').trim();
1929
+ if (!u) return '';
1930
+ return `<a class="onekite-user-link me-2" href="${window.location.origin}/user/${encodeURIComponent(u)}">${escapeHtml(u)}</a>`;
1931
+ }).filter(Boolean).join('')
1932
+ : `<span class="text-muted">Aucun</span>`;
1933
+ box.html(`<strong>Participants</strong><button type="button" class="btn btn-sm btn-success ms-2 onekite-join-outing" data-oid="${escapeHtml(oid)}" title="S'ajouter" aria-label="S'ajouter">+</button><br>${links}`);
1932
1934
  }
1933
- });
1935
+ } catch (e3) {
1936
+ showAlert('error', "Impossible de se retirer.");
1937
+ } finally {
1938
+ try { btn.classList.remove('disabled'); } catch (e4) {}
1939
+ }
1934
1940
  });
1935
1941
  } catch (e) {}
1936
1942
  try {