diff --git a/CHANGELOG.md b/CHANGELOG.md index 3db115d58..0b17a1c82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog Fab Manager ## next release (v2.5.0) +- Ability to remove an unused custom price for an event (#61) - Prevent polling notifications when the application is in background - Ability to export the availabilities and their reservation rate from the admin calendar - Ability to create, manage and reserve spaces diff --git a/app/assets/javascripts/controllers/admin/events.coffee.erb b/app/assets/javascripts/controllers/admin/events.coffee.erb index 9ef91e1c5..728a58cbb 100644 --- a/app/assets/javascripts/controllers/admin/events.coffee.erb +++ b/app/assets/javascripts/controllers/admin/events.coffee.erb @@ -16,6 +16,8 @@ # - $scope.toggleStartDatePicker($event) # - $scope.toggleEndDatePicker($event) # - $scope.toggleRecurrenceEnd(e) +# - $scope.addPrice() +# - $scope.removePrice(price, $event) # # Requires : # - $scope.event.event_files_attributes = [] @@ -137,6 +139,21 @@ class EventsController + ## + # Remove the price or mark it as 'to delete' + ## + $scope.removePrice = (price, event) -> + event.preventDefault() + event.stopPropagation() + if price.id + price._destroy = true + else + index = $scope.event.prices.indexOf(price) + $scope.event.prices.splice(index, 1) + + + + ## # Controller used in the events listing page (admin view) ## diff --git a/app/assets/templates/events/_form.html.erb b/app/assets/templates/events/_form.html.erb index b146fffac..b99fbf639 100644 --- a/app/assets/templates/events/_form.html.erb +++ b/app/assets/templates/events/_form.html.erb @@ -246,7 +246,7 @@ {{ '0_=_free' }} -
+
+ +