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 +1 -1
- package/plugin.json +1 -1
- package/public/client.js +106 -100
package/package.json
CHANGED
package/plugin.json
CHANGED
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.
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
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
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
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.
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
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
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
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 {
|