From 16ed469c72cd2f9d918374518bec58c17bfb881a Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 29 Nov 2016 17:56:41 +0100 Subject: [PATCH 1/3] add deploy instructions for 2.4.5 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c036fc9d5..d256af89b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Fix a bug: wallet is not debited when paying locally with a user who have invoices disabled - Fix a bug: wrong error message about rounding inconsistency is logged on invoice generation - Fix a bug: reservation calendar of a specific training shows availabilities for all trainings +- [TODO DEPLOY] `rake db:migrate` ## v2.4.4 2016 November 24 From 4c8b66175029607c5cad4917d1a7eee5a824820e Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 30 Nov 2016 10:17:05 +0100 Subject: [PATCH 2/3] display coupon application result in inline message instead of growl notification --- .../javascripts/directives/coupon.coffee.erb | 18 ++++++++++++++---- app/assets/templates/shared/_coupon.html.erb | 4 +++- app/controllers/api/prices_controller.rb | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/directives/coupon.coffee.erb b/app/assets/javascripts/directives/coupon.coffee.erb index 4392297bf7..4b42558f84 100644 --- a/app/assets/javascripts/directives/coupon.coffee.erb +++ b/app/assets/javascripts/directives/coupon.coffee.erb @@ -1,4 +1,4 @@ -Application.Directives.directive 'coupon', [ '$rootScope', 'Coupon', 'growl', '_t', ($rootScope, Coupon, growl, _t) -> +Application.Directives.directive 'coupon', [ '$rootScope', 'Coupon', '_t', ($rootScope, Coupon, _t) -> { restrict: 'E' scope: @@ -19,6 +19,9 @@ Application.Directives.directive 'coupon', [ '$rootScope', 'Coupon', 'growl', '_ # Binding for the code inputed (see the attached template) $scope.couponCode = null + # Code validation messages + $scope.messages = [] + # Re-compute if the code can be applied when the total of the cart changes $scope.$watch 'total', (newValue, oldValue) -> if newValue and newValue != oldValue and $scope.couponCode @@ -28,6 +31,7 @@ Application.Directives.directive 'coupon', [ '$rootScope', 'Coupon', 'growl', '_ # Callback to validate the code ## $scope.validateCode = -> + $scope.messages = [] if $scope.couponCode == '' $scope.status = 'pending' $scope.coupon = null @@ -36,13 +40,19 @@ Application.Directives.directive 'coupon', [ '$rootScope', 'Coupon', 'growl', '_ $scope.status = 'valid' $scope.coupon = res if res.type == 'percent_off' - growl.success(_t('the_coupon_has_been_applied_you_get_PERCENT_discount', {PERCENT: res.percent_off})) + $scope.messages.push(type: 'success', message: _t('the_coupon_has_been_applied_you_get_PERCENT_discount', {PERCENT: res.percent_off})) else - growl.success(_t('the_coupon_has_been_applied_you_get_AMOUNT_CURRENCY', {AMOUNT: res.amount_off, CURRENCY: $rootScope.currencySymbol})) + $scope.messages.push(type: 'success', message: _t('the_coupon_has_been_applied_you_get_AMOUNT_CURRENCY', {AMOUNT: res.amount_off, CURRENCY: $rootScope.currencySymbol})) , (err) -> $scope.status = 'invalid' $scope.coupon = null - growl.error(_t('unable_to_apply_the_coupon_because_'+err.data.status)) + $scope.messages.push(type: 'danger', message: _t('unable_to_apply_the_coupon_because_'+err.data.status)) + + ## + # Callback to remove the message at provided index from the displayed list + ## + $scope.closeMessage = (index) -> + $scope.messages.splice(index, 1); } ] diff --git a/app/assets/templates/shared/_coupon.html.erb b/app/assets/templates/shared/_coupon.html.erb index 7e00a29f5d..bc4552eced 100644 --- a/app/assets/templates/shared/_coupon.html.erb +++ b/app/assets/templates/shared/_coupon.html.erb @@ -3,7 +3,7 @@
-
+
+ + {{msg.message}}
diff --git a/app/controllers/api/prices_controller.rb b/app/controllers/api/prices_controller.rb index 2c9dacd10b..19acd769eb 100644 --- a/app/controllers/api/prices_controller.rb +++ b/app/controllers/api/prices_controller.rb @@ -41,7 +41,7 @@ def compute _user = User.find(_price_params[:user_id]) # reservable if _price_params[:reservable_id].nil? - @amount = {elements: nil, total: 0} + @amount = {elements: nil, total: 0, before_coupon: 0} else _reservable = _price_params[:reservable_type].constantize.find(_price_params[:reservable_id]) @amount = Price.compute(current_user.is_admin?, _user, _reservable, _price_params[:slots_attributes], _price_params[:plan_id], _price_params[:nb_reserve_places], _price_params[:tickets_attributes], coupon_params[:coupon_code]) From 3fad06c886c9f4b8587337adbad4096a0b75d115 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 30 Nov 2016 17:28:51 +0100 Subject: [PATCH 3/3] Version 2.4.6 --- .fabmanager-version | 2 +- CHANGELOG.md | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.fabmanager-version b/.fabmanager-version index 26f8b8bcdf..62e64205bf 100644 --- a/.fabmanager-version +++ b/.fabmanager-version @@ -1 +1 @@ -2.4.5 \ No newline at end of file +2.4.6 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d256af89b0..ed68f9cc0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog Fab Manager +## v2.4.6 2016 Novembre 30 + +- Change display of message about coupon application status +- Fix a bug: compute price API return error 500 if reservable_id is not provided + ## v2.4.5 2016 November 29 - Ability to create coupons with cash amounts (previously only percentages were allowed)