From 5abc85ae0a2170535bdf2b727640372c35674688 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 21 Mar 2017 13:06:02 +0100 Subject: [PATCH] [feature] weekly plans --- app/assets/templates/admin/plans/_form.html.erb | 1 + app/models/plan.rb | 2 +- config/locales/app.shared.en.yml | 1 + config/locales/app.shared.fr.yml | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/templates/admin/plans/_form.html.erb b/app/assets/templates/admin/plans/_form.html.erb index 609d5fe05..9f3e1bb38 100644 --- a/app/assets/templates/admin/plans/_form.html.erb +++ b/app/assets/templates/admin/plans/_form.html.erb @@ -49,6 +49,7 @@ ng-model="plan.interval" ng-disabled="method == 'PATCH'" required="required"> + diff --git a/app/models/plan.rb b/app/models/plan.rb index a9a7f72e2..16ecdbd5e 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -27,7 +27,7 @@ class Plan < ActiveRecord::Base validates :amount, :group, :base_name, presence: true validates :interval_count, numericality: { only_integer: true, greater_than_or_equal_to: 1 } - validates :interval, inclusion: { in: %w(year month) } + validates :interval, inclusion: { in: %w(year month week) } def self.create_for_all_groups(plan_params) plans = [] diff --git a/config/locales/app.shared.en.yml b/config/locales/app.shared.en.yml index 73717c478..146a5d7c1 100644 --- a/config/locales/app.shared.en.yml +++ b/config/locales/app.shared.en.yml @@ -213,6 +213,7 @@ en: period: "Period" year: "Year" month: "Month" + week: "Week" period_is_required: "Period is required." subscription_price: "Subscription price" price_is_required: "Price is required." diff --git a/config/locales/app.shared.fr.yml b/config/locales/app.shared.fr.yml index 31e080b30..b63e7154d 100644 --- a/config/locales/app.shared.fr.yml +++ b/config/locales/app.shared.fr.yml @@ -213,6 +213,7 @@ fr: period: "Période" year: "Année" month: "Mois" + week: "Semaine" period_is_required: "La période est requise." subscription_price: "Coût de l'abonnement" price_is_required: "Le prix est requis."