mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-01 12:24:28 +01:00
allow dashes in coupon codes
This commit is contained in:
parent
428b2db0ea
commit
8aa5d5e4f5
@ -14,11 +14,11 @@
|
||||
name="coupon[code]"
|
||||
class="form-control"
|
||||
ng-model="coupon.code"
|
||||
ng-pattern="/^[A-Z0-9]+$/"
|
||||
ng-pattern="/^[A-Z0-9\-]+$/"
|
||||
ng-disabled="mode == 'EDIT'"
|
||||
required="required"/>
|
||||
<span class="help-block error" ng-show="couponForm['coupon[code]'].$dirty && couponForm['coupon[code]'].$error.required" translate>{{ 'code_is_required' }}</span>
|
||||
<span class="help-block error" ng-show="couponForm['coupon[code]'].$dirty && couponForm['coupon[code]'].$error.pattern" translate>{{ 'code_must_be_composed_of_capital_letters_and_or_digits' }}</span>
|
||||
<span class="help-block error" ng-show="couponForm['coupon[code]'].$dirty && couponForm['coupon[code]'].$error.pattern" translate>{{ 'code_must_be_composed_of_capital_letters_digits_and_or_dashes' }}</span>
|
||||
</div>
|
||||
|
||||
<div class="form-group" ng-class="{'has-error': couponForm['coupon[percent_off]'].$dirty && couponForm['coupon[percent_off]'].$invalid}">
|
||||
|
@ -6,7 +6,7 @@ class Coupon < ActiveRecord::Base
|
||||
|
||||
validates :name, presence: true
|
||||
validates :code, presence: true
|
||||
validates :code, format: { with: /\A[A-Z0-9]+\z/ ,message: 'only caps letters and numbers'}
|
||||
validates :code, format: { with: /\A[A-Z0-9\-]+\z/ ,message: 'only caps letters and numbers'}
|
||||
validates :code, uniqueness: true
|
||||
validates :percent_off, presence: true
|
||||
validates :percent_off, :inclusion => 0..100
|
||||
|
@ -338,7 +338,7 @@ en:
|
||||
# promotional coupon (creation/edition form)
|
||||
code: "Code"
|
||||
code_is_required: "Code is required."
|
||||
code_must_be_composed_of_capital_letters_and_or_digits: "The code must be composed of capital letters and/or digits."
|
||||
code_must_be_composed_of_capital_letters_digits_and_or_dashes: "The code must be composed of capital letters, digits and/or dashes."
|
||||
percent_off: "Percentage off"
|
||||
percent_off_is_required: "Percentage off is required."
|
||||
percentage_must_be_between_0_and_100: "Percentage must be between 0 and 100."
|
||||
|
@ -338,7 +338,7 @@ fr:
|
||||
# code promotionnel (formulaire de création/édition)
|
||||
code: "Code"
|
||||
code_is_required: "Le code est requis."
|
||||
code_must_be_composed_of_capital_letters_and_or_digits: "Le code doit être composé de lettres majuscules et/ou de chiffres."
|
||||
code_must_be_composed_of_capital_letters_digits_and_or_dashes: "Le code doit être composé de lettres majuscules, de chiffres et/ou de tirets."
|
||||
percent_off: "Pourcentage de réduction"
|
||||
percent_off_is_required: "Le pourcentage de réduction est requis."
|
||||
percentage_must_be_between_0_and_100: "Le pourcentage doit être compris entre 0 et 100."
|
||||
|
Loading…
Reference in New Issue
Block a user