Class: DateLabelHelper::DueDateView

Inherits:
GenericDateView show all
Defined in:
app/helpers/date_label_helper.rb

Constant Summary

Constants inherited from GenericDateView

GenericDateView::COLORS

Instance Method Summary collapse

Methods inherited from GenericDateView

#date_html_wrapper, #date_mobile_html_wrapper, #days_from_today, #days_to_sym, #get_color, #initialize

Constructor Details

This class inherits a constructor from DateLabelHelper::GenericDateView

Instance Method Details

#due_date_htmlObject



89
90
91
# File 'app/helpers/date_label_helper.rb', line 89

def due_date_html
  date_html_wrapper { due_text }
end

#due_date_mobile_htmlObject



93
94
95
# File 'app/helpers/date_label_helper.rb', line 93

def due_date_mobile_html
  date_mobile_html_wrapper { @prefs.format_date(@due) }
end

#due_textObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'app/helpers/date_label_helper.rb', line 67

def due_text
  case @days_sym
  when :overdue_by_one
    t('todos.next_actions_due_date.overdue_by', :days => @days * -1)
  when :overdue_by_more_than_one
    t('todos.next_actions_due_date.overdue_by_plural', :days => @days * -1)
  when :today
    t('todos.next_actions_due_date.due_today')
  when :tomorrow
    t('todos.next_actions_due_date.due_tomorrow')
  when :this_week
    if @prefs.due_style == Preference.due_styles[:due_on]
      # TODO: internationalize strftime here
      t('models.preference.due_on', :date => @date.strftime("%A"))
    else
      t('models.preference.due_in', :days => @days)
    end
  else # should be :more_than_a_week
    t('models.preference.due_in', :days => @days)
  end
end