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



96
97
98
# File 'app/helpers/date_label_helper.rb', line 96

def due_date_html
  date_html_wrapper { due_text }
end

#due_date_mobile_htmlObject



100
101
102
# File 'app/helpers/date_label_helper.rb', line 100

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

#due_textObject



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'app/helpers/date_label_helper.rb', line 74

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