nodebb-plugin-onekite-calendar 2.0.45 → 2.0.47

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/lib/api.js CHANGED
@@ -507,7 +507,7 @@ function eventsForOuting(o) {
507
507
  type: 'outing',
508
508
  id: String(o.oid),
509
509
  uid: Number(o.uid) || 0,
510
- title: String(o.title || 'Prévision de sortie'),
510
+ title: String(o.title || 'Sortie'),
511
511
  details: String(o.notes || ''),
512
512
  location: String(o.address || ''),
513
513
  allDay: false,
@@ -516,7 +516,7 @@ function eventsForOuting(o) {
516
516
  });
517
517
  return {
518
518
  id: `outing:${o.oid}`,
519
- title: `${o.title || 'Prévision de sortie'}`.trim(),
519
+ title: `${o.title || 'Sortie'}`.trim(),
520
520
  allDay: false,
521
521
  start: startIso,
522
522
  end: endIso,
@@ -544,7 +544,6 @@ const api = {};
544
544
  // --------------------
545
545
  // Calendar export helpers (ICS / Google Calendar template link)
546
546
  // --------------------
547
- const nconf = require.main.require('nconf');
548
547
  function baseUrl() {
549
548
  try {
550
549
  return String(nconf.get('url') || '').replace(/\/$/, '');
@@ -883,6 +882,19 @@ api.getSpecialEventDetails = async function (req, res) {
883
882
  const ev = await dbLayer.getSpecialEvent(eid);
884
883
  if (!ev) return res.status(404).json({ error: 'not-found' });
885
884
 
885
+ // Calendar export links (ICS / Google Calendar)
886
+ const links = buildCalendarLinks({
887
+ type: 'special',
888
+ id: String(ev.eid),
889
+ uid: Number(ev.uid) || 0,
890
+ title: String(ev.title || 'Évènement'),
891
+ details: String(ev.notes || ''),
892
+ location: String(ev.address || ''),
893
+ allDay: false,
894
+ start: new Date(parseInt(ev.start, 10)),
895
+ end: new Date(parseInt(ev.end, 10)),
896
+ });
897
+
886
898
  // Anyone who can see the calendar can view special events, but creator username
887
899
  // is only visible to moderators/allowed users or the creator.
888
900
  const out = {
@@ -895,6 +907,8 @@ api.getSpecialEventDetails = async function (req, res) {
895
907
  lon: ev.lon || '',
896
908
  notes: ev.notes || '',
897
909
  canDeleteSpecial: canSpecialDelete,
910
+ icsUrl: links.icsUrl,
911
+ googleCalUrl: links.googleCalUrl,
898
912
  };
899
913
  if (ev.username && (canMod || canSpecialDelete || (uid && String(uid) === String(ev.uid)))) {
900
914
  out.username = String(ev.username);
@@ -999,6 +1013,19 @@ api.getOutingDetails = async function (req, res) {
999
1013
  const o = await dbLayer.getOuting(oid);
1000
1014
  if (!o) return res.status(404).json({ error: 'not-found' });
1001
1015
 
1016
+ // Calendar export links (ICS / Google Calendar)
1017
+ const links = buildCalendarLinks({
1018
+ type: 'outing',
1019
+ id: String(o.oid),
1020
+ uid: Number(o.uid) || 0,
1021
+ title: String(o.title || 'Sortie'),
1022
+ details: String(o.notes || ''),
1023
+ location: String(o.address || ''),
1024
+ allDay: false,
1025
+ start: new Date(parseInt(o.start, 10)),
1026
+ end: new Date(parseInt(o.end, 10)),
1027
+ });
1028
+
1002
1029
  const out = {
1003
1030
  oid: o.oid,
1004
1031
  title: o.title || '',
@@ -1009,6 +1036,8 @@ api.getOutingDetails = async function (req, res) {
1009
1036
  lon: o.lon || '',
1010
1037
  notes: o.notes || '',
1011
1038
  canDeleteOuting: canMod || (uid && String(uid) === String(o.uid)),
1039
+ icsUrl: links.icsUrl,
1040
+ googleCalUrl: links.googleCalUrl,
1012
1041
  };
1013
1042
  if (o.username && (canMod || (uid && String(uid) === String(o.uid)))) {
1014
1043
  out.username = String(o.username);
@@ -1024,7 +1053,7 @@ api.createOuting = async function (req, res) {
1024
1053
  const ok = await canRequest(req.uid, settings, startTs);
1025
1054
  if (!ok) return res.status(403).json({ error: 'not-allowed' });
1026
1055
 
1027
- const title = String((req.body && req.body.title) || '').trim() || 'Prévision de sortie';
1056
+ const title = String((req.body && req.body.title) || '').trim() || 'Sortie';
1028
1057
  const endTs = toTs(req.body && req.body.end);
1029
1058
  if (!Number.isFinite(startTs) || !Number.isFinite(endTs) || !(startTs < endTs)) {
1030
1059
  return res.status(400).json({ error: 'bad-dates' });
@@ -1935,7 +1964,7 @@ api.getIcs = async function (req, res) {
1935
1964
  const end = new Date(parseInt(o.end, 10));
1936
1965
  ics = buildIcs({
1937
1966
  uid: `outing-${id}@onekite`,
1938
- summary: String(o.title || 'Prévision de sortie'),
1967
+ summary: String(o.title || 'Sortie'),
1939
1968
  description: String(o.notes || ''),
1940
1969
  location: String(o.address || ''),
1941
1970
  allDay: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-onekite-calendar",
3
- "version": "2.0.45",
3
+ "version": "2.0.47",
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.45"
42
+ "version": "2.0.47"
43
43
  }
package/public/client.js CHANGED
@@ -62,33 +62,24 @@ define('forum/calendar-onekite', ['alerts', 'bootbox', 'hooks'], function (alert
62
62
  }
63
63
  }
64
64
 
65
- /* Calendar item action buttons (match calendar colors) */
65
+ /* Creation chooser buttons: outline only, match calendar colors */
66
+ .btn-onekite-special,
67
+ .btn-onekite-outing,
68
+ .btn-onekite-location {
69
+ background: transparent;
70
+ border-width: 2px;
71
+ }
66
72
  .btn-onekite-special {
67
- background: #8e44ad;
68
73
  border-color: #8e44ad;
69
- color: #fff;
70
- }
71
- .btn-onekite-special:hover {
72
- filter: brightness(0.95);
73
- color: #fff;
74
+ color: #8e44ad;
74
75
  }
75
76
  .btn-onekite-outing {
76
- background: #2980b9;
77
77
  border-color: #2980b9;
78
- color: #fff;
79
- }
80
- .btn-onekite-outing:hover {
81
- filter: brightness(0.95);
82
- color: #fff;
78
+ color: #2980b9;
83
79
  }
84
80
  .btn-onekite-location {
85
- background: #27ae60;
86
81
  border-color: #27ae60;
87
- color: #fff;
88
- }
89
- .btn-onekite-location:hover {
90
- filter: brightness(0.95);
91
- color: #fff;
82
+ color: #27ae60;
92
83
  }
93
84
 
94
85
  /* Mobile FAB date range picker (single calendar) */
@@ -294,8 +285,10 @@ define('forum/calendar-onekite', ['alerts', 'bootbox', 'hooks'], function (alert
294
285
 
295
286
  const seStartTime = timeString(seStart);
296
287
  const seEndTime = timeString(seEnd);
297
- const defaultTitlePlaceholder = kind === 'outing' ? 'Prévision de sortie' : 'Ex: ...';
298
- const defaultTitleValue = kind === 'outing' ? 'Prévision de sortie' : '';
288
+ // Same UX for all types: an example placeholder, but never pre-fill the value.
289
+ // If left empty, the server can still apply its own default label.
290
+ const defaultTitlePlaceholder = 'Ex: ...';
291
+ const defaultTitleValue = '';
299
292
 
300
293
  const html = `
301
294
  <div class="mb-3">
@@ -472,8 +465,6 @@ define('forum/calendar-onekite', ['alerts', 'bootbox', 'hooks'], function (alert
472
465
  // a different title.
473
466
  const payload = await openSpecialEventDialog(selectionInfo, { kind: 'outing' });
474
467
  if (!payload) return null;
475
- // Default title if empty
476
- if (!payload.title) payload.title = 'Prévision de sortie';
477
468
  return payload;
478
469
  }
479
470
 
@@ -1696,7 +1687,7 @@ function toDatetimeLocalValue(date) {
1696
1687
  `;
1697
1688
  const canDel = !!(p.canDeleteOuting);
1698
1689
  const dlg = bootbox.dialog({
1699
- title: 'Prévision de sortie',
1690
+ title: 'Sortie',
1700
1691
  message: html,
1701
1692
  buttons: {
1702
1693
  close: { label: 'Fermer', className: 'btn-secondary' },