Skip to content

Commit 18e48bf

Browse files
committed
(feat) icalendar links
1 parent 2354359 commit 18e48bf

26 files changed

+161
-171
lines changed

app/frontend/src/javascript/controllers/admin/calendar.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,59 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
306306
* Setup the feature-tour for the admin/calendar page.
307307
* This is intended as a contextual help (when pressing F1)
308308
*/
309+
/**
310+
* Open the iCal links modal
311+
*/
312+
$scope.openICalLinksModal = function () {
313+
const modalInstance = $uibModal.open({
314+
animation: true,
315+
templateUrl: '/calendar/ical_links.html',
316+
size: 'md',
317+
controller: ['$scope', '$uibModalInstance', function ($scope, $uibModalInstance) {
318+
$scope.icalLinks = [];
319+
if (Fablab.machinesModule) {
320+
$scope.icalLinks.push({
321+
type: 'Machine',
322+
name: _t('app.admin.calendar.machine_reservations'),
323+
url: `webcal://${window.location.host}/ical/reservations/machine`
324+
});
325+
}
326+
if (Fablab.trainingsModule) {
327+
$scope.icalLinks.push({
328+
type: 'Training',
329+
name: _t('app.admin.calendar.training_reservations'),
330+
url: `webcal://${window.location.host}/ical/availabilities/training`
331+
});
332+
}
333+
if (Fablab.spacesModule) {
334+
$scope.icalLinks.push({
335+
type: 'Space',
336+
name: _t('app.admin.calendar.space_reservations'),
337+
url: `webcal://${window.location.host}/ical/availabilities/space`
338+
});
339+
}
340+
$scope.icalLinks.push({
341+
type: 'Event',
342+
name: _t('app.admin.calendar.event_reservations'),
343+
url: `webcal://${window.location.host}/ical/reservations/event`
344+
});
345+
346+
$scope.copyToClipboard = function (url) {
347+
navigator.clipboard.writeText(url).then(function () {
348+
growl.success(_t('app.admin.calendar.link_copied'));
349+
}).catch(function () {
350+
growl.error(_t('app.admin.calendar.copy_failed'));
351+
});
352+
};
353+
354+
$scope.close = function () {
355+
$uibModalInstance.dismiss();
356+
};
357+
}]
358+
});
359+
return modalInstance;
360+
};
361+
309362
$scope.setupCalendarTour = function () {
310363
// get the tour defined by the ui-tour directive
311364
const uitour = uiTourService.getTourByName('calendar');

app/frontend/src/javascript/controllers/calendar.js

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -130,56 +130,6 @@ Application.Controllers.controller('CalendarController', ['$scope', '$state', '$
130130
$scope.filterAvailabilities(filter, $scope);
131131
};
132132

133-
$scope.openICalLinksModal = function () {
134-
const modalInstance = $uibModal.open({
135-
animation: true,
136-
templateUrl: '/calendar/ical_links.html',
137-
size: 'md',
138-
controller: ['$scope', '$uibModalInstance', function ($scope, $uibModalInstance) {
139-
$scope.icalLinks = [];
140-
if (Fablab.machinesModule) {
141-
$scope.icalLinks.push({
142-
type: 'Machine',
143-
name: _t('app.shared.calendar.machine_reservations'),
144-
url: `webcal://${window.location.host}/ical/reservations/machine`
145-
});
146-
}
147-
if (Fablab.trainingsModule) {
148-
$scope.icalLinks.push({
149-
type: 'Training',
150-
name: _t('app.shared.calendar.training_reservations'),
151-
url: `webcal://${window.location.host}/ical/availabilities/training`
152-
});
153-
}
154-
if (Fablab.spacesModule) {
155-
$scope.icalLinks.push({
156-
type: 'Space',
157-
name: _t('app.shared.calendar.space_reservations'),
158-
url: `webcal://${window.location.host}/ical/availabilities/space`
159-
});
160-
}
161-
$scope.icalLinks.push({
162-
type: 'Event',
163-
name: _t('app.shared.calendar.event_reservations'),
164-
url: `webcal://${window.location.host}/ical/reservations/event`
165-
});
166-
167-
$scope.copyToClipboard = function (url) {
168-
navigator.clipboard.writeText(url).then(function () {
169-
growl.success(_t('app.shared.calendar.link_copied'));
170-
}).catch(function () {
171-
growl.error(_t('app.shared.calendar.copy_failed'));
172-
});
173-
};
174-
175-
$scope.close = function () {
176-
$uibModalInstance.dismiss();
177-
};
178-
}]
179-
});
180-
return modalInstance;
181-
};
182-
183133
$scope.openFilterAside = () =>
184134
$aside.open({
185135
templateUrl: '/calendar/filterAside.html',

app/frontend/templates/admin/calendar/calendar.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ <h4 translate>{{ 'app.admin.calendar.legend' }}</h4>
5454
</a>
5555
<iframe name="export-frame" height="0" width="0" class="none"></iframe>
5656
</div>
57+
<button type="button" class="btn btn-default m-l" ng-click="openICalLinksModal()">
58+
<span class="fas fa-calendar-alt"></span> {{ 'app.admin.calendar.ical_links' | translate }}
59+
</button>
5760
<button type="button" class="btn btn-default m-l" ng-click="openFilterAside()">
5861
<span class="fa fa-filter"></span> {{ 'app.shared.calendar.filter_calendar' | translate }}
5962
</button>

app/frontend/templates/calendar/calendar.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ <h1 translate>{{ 'app.public.calendar.calendar' }}</h1>
2121
<span ng-if="autoRefresh">{{ 'app.shared.calendar.auto_refresh_on' | translate }}</span>
2222
<span ng-if="!autoRefresh">{{ 'app.shared.calendar.auto_refresh_off' | translate }}</span>
2323
</button>
24-
<button type="button" class="btn btn-default m-t m-b m-r-sm" ng-click="openICalLinksModal()">
25-
<span class="fas fa-calendar-alt"></span> {{ 'app.shared.calendar.ical_links' | translate }}
26-
</button>
2724
<button type="button" class="btn btn-default m-t m-b" ng-click="triggerOnlyCalendarViewMode()">
2825
<span class="fas fa-expand"></span>
2926
</button>

app/frontend/templates/calendar/ical_links.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<div class="modal-header">
2-
<h3 class="modal-title">{{ 'app.shared.calendar.ical_links' | translate }}</h3>
2+
<h3 class="modal-title">{{ 'app.admin.calendar.ical_links' | translate }}</h3>
33
</div>
44

55
<div class="modal-body">
6-
<p class="text-muted">{{ 'app.shared.calendar.ical_description' | translate }}</p>
6+
<p class="text-muted">{{ 'app.admin.calendar.ical_description' | translate }}</p>
77

88
<div class="list-group">
99
<div class="list-group-item" ng-repeat="link in icalLinks">
@@ -17,7 +17,7 @@ <h5 class="list-group-item-heading m-b">
1717
</div>
1818
<div class="col-md-4 text-right">
1919
<button type="button" class="btn btn-outline-primary btn-sm" ng-click="copyToClipboard(link.url)">
20-
<i class="fas fa-copy"></i> {{ 'app.shared.calendar.copy_link' | translate }}
20+
<i class="fas fa-copy"></i> {{ 'app.admin.calendar.copy_link' | translate }}
2121
</button>
2222
</div>
2323
</div>
@@ -26,7 +26,7 @@ <h5 class="list-group-item-heading m-b">
2626

2727
<div class="alert alert-info" role="alert">
2828
<i class="fas fa-info-circle"></i>
29-
{{ 'app.shared.calendar.ical_usage_info' | translate }}
29+
{{ 'app.admin.calendar.ical_usage_info' | translate }}
3030
</div>
3131
</div>
3232

config/locales/app.admin.de.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,16 @@ de:
405405
deleted_user: "Gelöschter Nutzer"
406406
select_type: "Please select a type to continue"
407407
no_modules_available: "No reservable module available. Please enable at least one module (machines, spaces or trainings) in the Customization section."
408+
ical_links: "iCal-Links"
409+
ical_description: "Verwenden Sie diese Links, um Reservierungskalender in Ihrer bevorzugten Kalender-App zu abonnieren."
410+
copy_link: "Link kopieren"
411+
ical_usage_info: "Kopieren Sie diese webcal://-Links in Ihre Kalender-App, um automatische Updates zu abonnieren."
412+
link_copied: "Link in die Zwischenablage kopiert!"
413+
copy_failed: "Fehler beim Kopieren des Links"
414+
machine_reservations: "Maschinenreservierungen"
415+
training_reservations: "Schulungsreservierungen"
416+
event_reservations: "Veranstaltungsreservierungen"
417+
space_reservations: "Raumreservierungen"
408418
#import external iCal calendar
409419
icalendar:
410420
icalendar_import: "iCalendar Import"

config/locales/app.admin.en.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,16 @@ en:
405405
deleted_user: "Deleted user"
406406
select_type: "Please select a type to continue"
407407
no_modules_available: "No reservable module available. Please enable at least one module (machines, spaces or trainings) in the Customization section."
408+
ical_links: "iCal links"
409+
ical_description: "Use the following links to subscribe to reservation calendars in your calendar application."
410+
copy_link: "Copy Link"
411+
ical_usage_info: "Add these links to your calendar application (such as Google Calendar, Outlook, etc.) to automatically sync reservation information."
412+
link_copied: "Link copied to clipboard"
413+
copy_failed: "Copy failed, please copy the link manually"
414+
machine_reservations: "Machine Reservations"
415+
training_reservations: "Training Reservations"
416+
event_reservations: "Event Reservations"
417+
space_reservations: "Space Reservations"
408418
# import external iCal calendar
409419
icalendar:
410420
icalendar_import: "iCalendar import"

config/locales/app.admin.es-MX.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,16 @@ es-MX:
405405
deleted_user: "Usuario suprimido"
406406
select_type: "Seleccione un tipo para continuar"
407407
no_modules_available: "No hay ningún módulo reservable disponible. Habilite al menos un módulo (máquinas, espacios o capacitaciones) en la sección Personalización."
408+
ical_links: "Enlaces iCal"
409+
ical_description: "Use estos enlaces para suscribirse a calendarios de reservas en su aplicación de calendario preferida."
410+
copy_link: "Copiar enlace"
411+
ical_usage_info: "Copie estos enlaces webcal:// en su aplicación de calendario para suscribirse a actualizaciones automáticas."
412+
link_copied: "¡Enlace copiado al portapapeles!"
413+
copy_failed: "Error al copiar el enlace"
414+
machine_reservations: "Reservas de máquinas"
415+
training_reservations: "Reservas de capacitaciones"
416+
event_reservations: "Reservas de eventos"
417+
space_reservations: "Reservas de espacios"
408418
#import external iCal calendar
409419
icalendar:
410420
icalendar_import: "Importar iCalendar"

config/locales/app.admin.es.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,16 @@ es:
405405
deleted_user: "Usuario suprimido"
406406
select_type: "Seleccione un tipo para continuar"
407407
no_modules_available: "No hay ningún módulo reservable disponible. Habilite al menos un módulo (máquinas, espacios o capacitaciones) en la sección Personalización."
408+
ical_links: "Enlaces iCal"
409+
ical_description: "Use estos enlaces para suscribirse a calendarios de reservas en su aplicación de calendario preferida."
410+
copy_link: "Copiar enlace"
411+
ical_usage_info: "Copie estos enlaces webcal:// en su aplicación de calendario para suscribirse a actualizaciones automáticas."
412+
link_copied: "¡Enlace copiado al portapapeles!"
413+
copy_failed: "Error al copiar el enlace"
414+
machine_reservations: "Reservas de máquinas"
415+
training_reservations: "Reservas de capacitaciones"
416+
event_reservations: "Reservas de eventos"
417+
space_reservations: "Reservas de espacios"
408418
#import external iCal calendar
409419
icalendar:
410420
icalendar_import: "Importar iCalendar"

config/locales/app.admin.fr.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,16 @@ fr:
405405
deleted_user: "Utilisateur supprimé"
406406
select_type: "Veuillez sélectionner un type pour continuer"
407407
no_modules_available: "Aucun module réservable n'est disponible. Veuillez activer au moins un module (machines, espaces ou formations) dans la section Personnalisation."
408+
ical_links: "Liens iCal"
409+
ical_description: "Utilisez ces liens pour vous abonner aux calendriers de réservation dans votre application de calendrier préférée."
410+
copy_link: "Copier le lien"
411+
ical_usage_info: "Copiez ces liens webcal:// dans votre application de calendrier pour vous abonner aux mises à jour automatiques."
412+
link_copied: "Lien copié dans le presse-papiers !"
413+
copy_failed: "Échec de la copie du lien"
414+
machine_reservations: "Réservations de machines"
415+
training_reservations: "Réservations de formations"
416+
event_reservations: "Réservations d'événements"
417+
space_reservations: "Réservations d'espaces"
408418
#import external iCal calendar
409419
icalendar:
410420
icalendar_import: "Import iCalendar"

0 commit comments

Comments
 (0)