diff --git a/CHANGELOG.md b/CHANGELOG.md index bb3db7540..86325760f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## next release - Improved automated testing - Added an information notice about the processing time of deleting an administrator +- Ability to change the expiration date of a coupon after its creation - Fix a bug: unable to run rake db:migrate on first install - Fix a bug: unable to create or edit a coupon of type 'percentage' diff --git a/app/assets/javascripts/controllers/admin/coupons.coffee b/app/assets/javascripts/controllers/admin/coupons.coffee index 5433d4248..c62693e80 100644 --- a/app/assets/javascripts/controllers/admin/coupons.coffee +++ b/app/assets/javascripts/controllers/admin/coupons.coffee @@ -73,6 +73,9 @@ Application.Controllers.controller "EditCouponController", ["$scope", "$state", ## Options for the validity per user $scope.validities = userValidities + ## Mapping for validation errors + $scope.errors = {} + ## Default parameters for AngularUI-Bootstrap datepicker (used for coupon validity limit selection) $scope.datePicker = format: Fablab.uibDateFormat @@ -98,11 +101,12 @@ Application.Controllers.controller "EditCouponController", ["$scope", "$state", # Callback to save the coupon's changes to the API ## $scope.updateCoupon = -> + $scope.errors = {} Coupon.update {id: $scope.coupon.id}, coupon: $scope.coupon, (coupon) -> $state.go('app.admin.pricing') , (err)-> growl.error(_t('unable_to_update_the_coupon_an_error_occurred')) - console.error(err) + $scope.errors = err.data diff --git a/app/assets/templates/admin/coupons/_form.html.erb b/app/assets/templates/admin/coupons/_form.html.erb index 87ce08937..9a54b7995 100644 --- a/app/assets/templates/admin/coupons/_form.html.erb +++ b/app/assets/templates/admin/coupons/_form.html.erb @@ -81,7 +81,7 @@ {{ 'validity_per_user_is_required' }} -