move as_text helpers to respective pattern

This commit is contained in:
Reinier Balt 2014-02-23 15:54:02 +01:00
parent cbdbb792a5
commit d8507bf8b7
6 changed files with 77 additions and 85 deletions

View file

@ -14,6 +14,16 @@ module RecurringTodos
get :only_work_days
end
def recurrence_pattern
if only_work_days?
I18n.t("todos.recurrence.pattern.on_work_days")
elsif every_x_days > 1
I18n.t("todos.recurrence.pattern.every_n", :n => every_x_days) + " " + I18n.t("common.days_midsentence.other")
else
I18n.t("todos.recurrence.pattern.every_day")
end
end
def validate
super
errors[:base] << "Every other nth day may not be empty for this daily recurrence setting" if (!only_work_days?) && every_x_days.blank?