1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

removed full-calendar hack, improved remove slot precess

This commit is contained in:
Sylvain 2017-09-18 12:42:45 +02:00
parent 7d9d0cd075
commit 8d92f8492a
9 changed files with 42 additions and 15 deletions

View File

@ -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

View File

@ -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.
<a name="setup-a-production-environment"></a>
## Setup a production environment

View File

@ -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('<span class="remove-event">x&nbsp;</span>')
if event.tags.length > 0
html = ''
for tag in event.tags

View File

@ -90,6 +90,12 @@
<span class="m-l-xs" translate>{{ 'admin_calendar.allow_reservations' }}</span>
</span>
</button>
<button class="btn btn-default m-t" ng-click="removeSlot()">
<span>
<i class="fa fa-trash" />
<span class="m-l-xs" translate>{{ 'admin_calendar.delete_slot' }}</span>
</span>
</button>
</div>
</div>
</div>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"
}

View File

@ -5067,8 +5067,6 @@ DayGrid.mixin({
) +
'>' +
'<div class="fc-content">' +
// modified sleede peng
'<span class="remove-event">x&nbsp;</span>' +
(this.isRTL ?
titleHtml + ' ' + timeHtml : // put a natural space in between
timeHtml + ' ' + titleHtml //
@ -6272,8 +6270,6 @@ TimeGrid.mixin({
) +
'>' +
'<div class="fc-content">' +
// modified sleede peng
'<span class="remove-event">x&nbsp;</span>' +
(timeText ?
'<div class="fc-time"' +
' data-start="' + htmlEscape(startTimeText) + '"' +