From 8d92f8492a62a44145c933f7226298d22229d8ce Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 18 Sep 2017 12:42:45 +0200 Subject: [PATCH] removed full-calendar hack, improved remove slot precess --- CHANGELOG.md | 3 ++ README.md | 2 -- .../controllers/admin/calendar.coffee.erb | 32 +++++++++++++++---- .../admin/calendar/calendar.html.erb | 6 ++++ config/locales/app.admin.en.yml | 2 ++ config/locales/app.admin.fr.yml | 2 ++ config/locales/app.admin.pt.yml | 2 ++ .../components/fullcalendar/.bower.json | 4 +-- .../fullcalendar/dist/fullcalendar.js | 4 --- 9 files changed, 42 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54bd8ce65..a295a5ed0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## next release +- Additional button to delete a slot, allowing to delete slots masked by others +- Removed cross hack in full-calendar +- Confirmation before slot delete - Fix a typo: error message while creating a machine slot - Updated test data to allow passing test suite diff --git a/README.md b/README.md index ae1a09838..1f1798f24 100644 --- a/README.md +++ b/README.md @@ -53,8 +53,6 @@ FabManager is a Ruby on Rails / AngularJS web application that runs on the follo Contributions are welcome. Please read [the contribution guidelines](CONTRIBUTING.md) for more information about the contribution process. -**IMPORTANT**: **do not** update Arshaw/fullCalendar.js as it contains a hack for the remove-event cross. - ## Setup a production environment diff --git a/app/assets/javascripts/controllers/admin/calendar.coffee.erb b/app/assets/javascripts/controllers/admin/calendar.coffee.erb index bb9764117..2b0260deb 100644 --- a/app/assets/javascripts/controllers/admin/calendar.coffee.erb +++ b/app/assets/javascripts/controllers/admin/calendar.coffee.erb @@ -165,8 +165,30 @@ Application.Controllers.controller "AdminCalendarController", ["$scope", "$state growl.error(_t('admin_calendar.unlockable_because_reservations')) + ## + # Confirm and destroy the slot in $scope.availability + ## + $scope.removeSlot = -> + # open a confirmation dialog + dialogs.confirm + resolve: + object: -> + title: _t('admin_calendar.confirmation_required') + msg: _t("admin_calendar.do_you_really_want_to_delete_this_slot") + , -> + # the admin has confirmed, delete the slot + Availability.delete id: $scope.availability.id, -> + uiCalendarConfig.calendars.calendar.fullCalendar 'removeEvents', $scope.availability.id - ### PRIVATE SCOPE ### + growl.success(_t('admin_calendar.the_slot_START-END_has_been_successfully_deleted', {START:moment(event.start).format('LL LT'), END:moment(event.end).format('LT')})) + $scope.availability = null + ,-> + growl.error(_t('admin_calendar.unable_to_delete_the_slot_START-END_because_it_s_already_reserved_by_a_member', {START:moment(event.start).format('LL LT'), END:moment(event.end).format('LT')})) + + + + + ### PRIVATE SCOPE ### ## # Return an enumerable meaninful string for the gender of the provider user @@ -235,12 +257,7 @@ Application.Controllers.controller "AdminCalendarController", ["$scope", "$state # if the user has clicked on the delete event button, delete the event if ($(jsEvent.target).hasClass('remove-event')) - Availability.delete id: event.id, -> - uiCalendarConfig.calendars.calendar.fullCalendar 'removeEvents', event.id - - growl.success(_t('admin_calendar.the_slot_START-END_has_been_successfully_deleted', {START:moment(event.start).format('LL LT'), END:moment(event.end).format('LT')})) - ,-> - growl.error(_t('admin_calendar.unable_to_delete_the_slot_START-END_because_it_s_already_reserved_by_a_member', {START:moment(event.start).format('LL LT'), END:moment(event.end).format('LT')})) + $scope.removeSlot() # if the user has only clicked on the event, display its reservations else Availability.reservations {id: event.id}, (reservations) -> @@ -255,6 +272,7 @@ Application.Controllers.controller "AdminCalendarController", ["$scope", "$state # @see http://fullcalendar.io/docs/event_rendering/eventRender/ ## eventRenderCb = (event, element) -> + element.find('.fc-content').prepend('') if event.tags.length > 0 html = '' for tag in event.tags diff --git a/app/assets/templates/admin/calendar/calendar.html.erb b/app/assets/templates/admin/calendar/calendar.html.erb index e8909d26e..3b78432b2 100644 --- a/app/assets/templates/admin/calendar/calendar.html.erb +++ b/app/assets/templates/admin/calendar/calendar.html.erb @@ -90,6 +90,12 @@ {{ 'admin_calendar.allow_reservations' }} + diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index f26c9f1fe..25c8790da 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -59,6 +59,8 @@ en: unlocking_failed: "An error occurred. Slot unlocking has failed" reservations_locked: "Booking is blocked" unlockable_because_reservations: "Unable to block booking on this slot because some uncancelled reservations exist on it." + delete_slot: "Delete this slot" + do_you_really_want_to_delete_this_slot: "Do you really want to delete this slot?" project_elements: # management of the projects' components diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index 8c92f8c20..e5b9c6f85 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -59,6 +59,8 @@ fr: unlocking_failed: "Une erreur est survenue. Le déverrouillage du créneau a échoué" reservations_locked: "Réservations bloquées" unlockable_because_reservations: "Impossible de bloquer les réservations sur ce créneau car il existe des réservations non annulées sur celui-ci." + delete_slot: "Supprimer le créneau" + do_you_really_want_to_delete_this_slot: "Êtes vous sur de vouloir supprimer ce créneau ?" project_elements: # gestion des éléments constituant les projets diff --git a/config/locales/app.admin.pt.yml b/config/locales/app.admin.pt.yml index 0938b9c0e..0308fb823 100755 --- a/config/locales/app.admin.pt.yml +++ b/config/locales/app.admin.pt.yml @@ -59,6 +59,8 @@ pt: unlocking_failed: "Um erro ocorreu. O desbloqueio do slot falhou" reservations_locked: "Reserva é bloqueado" unlockable_because_reservations: "Não é possível bloquear a reserva neste slot porque existem algumas reservas não cancelados nele." + delete_slot: "Exclua o slot" + do_you_really_want_to_delete_this_slot: "Você realmente quer excluir esse slot?" project_elements: # management of the projects' components diff --git a/vendor/assets/components/fullcalendar/.bower.json b/vendor/assets/components/fullcalendar/.bower.json index b61a3e529..83743d4cb 100644 --- a/vendor/assets/components/fullcalendar/.bower.json +++ b/vendor/assets/components/fullcalendar/.bower.json @@ -56,7 +56,7 @@ "tag": "v2.3.1", "commit": "ff991ab6450934507437391d4753380c66e39436" }, - "_source": "git://github.com/arshaw/fullcalendar.git", - "_target": "~2.x", + "_source": "https://github.com/fullcalendar/fullcalendar.git", + "_target": "=2.3.1", "_originalSource": "fullcalendar" } \ No newline at end of file diff --git a/vendor/assets/components/fullcalendar/dist/fullcalendar.js b/vendor/assets/components/fullcalendar/dist/fullcalendar.js index 5cd97be76..2e0618e53 100644 --- a/vendor/assets/components/fullcalendar/dist/fullcalendar.js +++ b/vendor/assets/components/fullcalendar/dist/fullcalendar.js @@ -5067,8 +5067,6 @@ DayGrid.mixin({ ) + '>' + '
' + - // modified sleede peng - '' + (this.isRTL ? titleHtml + ' ' + timeHtml : // put a natural space in between timeHtml + ' ' + titleHtml // @@ -6272,8 +6270,6 @@ TimeGrid.mixin({ ) + '>' + '
' + - // modified sleede peng - '' + (timeText ? '