mirror of
https://github.com/TracksApp/tracks.git
synced 2026-03-04 03:50:17 +01:00
move as_text helpers to respective pattern
This commit is contained in:
parent
cbdbb792a5
commit
d8507bf8b7
6 changed files with 77 additions and 85 deletions
|
|
@ -22,10 +22,6 @@ module RecurringTodos
|
|||
get(:recurrence_selector) == 1
|
||||
end
|
||||
|
||||
def every_xth_day
|
||||
get :every_other2
|
||||
end
|
||||
|
||||
def every_x_month
|
||||
# in case monthly pattern is every day x, return every_other2 otherwise
|
||||
# return a default value
|
||||
|
|
@ -46,6 +42,25 @@ module RecurringTodos
|
|||
get :every_count
|
||||
end
|
||||
|
||||
def recurrence_pattern
|
||||
if recurrence_selector == 0
|
||||
on_day = " #{I18n.t('todos.recurrence.pattern.on_day_n', :n => every_x_day)}"
|
||||
if every_xth_day(0) > 1
|
||||
I18n.t("todos.recurrence.pattern.every_n", :n => every_xth_day) + " " + I18n.t('common.months') + on_day
|
||||
else
|
||||
I18n.t("todos.recurrence.pattern.every_month") + on_day
|
||||
end
|
||||
else
|
||||
n_months = if get(:every_other2) > 1
|
||||
"#{get(:every_other2)} #{I18n.t('common.months')}"
|
||||
else
|
||||
I18n.t('common.month')
|
||||
end
|
||||
I18n.t('todos.recurrence.pattern.every_xth_day_of_every_n_months',
|
||||
:x => xth(every_xth_day), :day => day_of_week_as_text(day_of_week), :n_months => n_months)
|
||||
end
|
||||
end
|
||||
|
||||
def validate
|
||||
super
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue