Project

General

Profile

Feature #14642 » issue_14642_patch.diff

Jun Zhang, 2013-08-29 04:28

View differences:

config/locales/en.yml (working copy)
673 673
  label_today: today
674 674
  label_all_time: all time
675 675
  label_yesterday: yesterday
676
  label_tomorrow: tomorrow
676 677
  label_this_week: this week
677 678
  label_last_week: last week
678 679
  label_last_n_weeks: "last %{count} weeks"
app/helpers/queries_helper.rb (working copy)
88 88
      column_value(column, issue, value)
89 89
    end
90 90
  end
91

  
92
  def format_date_yesterday_today_tomorrow(value)
93
    today = Time.now
94
    yesterday = Time.now - 60*60*24
95
    tomorrow = Time.now + 60*60*24
96
    if today.year == value.year and today.month == value.month and today.day == value.day
97
      l:label_today
98
    elsif yesterday.year == value.year and yesterday.month == value.month and yesterday.day == value.day
99
      l:label_yesterday
100
    elsif tomorrow.year == value.year and tomorrow.month == value.month and tomorrow.day == value.day
101
      l:label_tomorrow
102
    else
103
      case value.class.name
104
      when 'Time'
105
        format_time(value)
106
      when 'Date'
107
        format_date(value)
108
      end
109
    end
110
  end 
91 111
  
92 112
  def column_value(column, issue, value)
93 113
    case value.class.name
......
99 119
      else
100 120
        h(value)
101 121
      end
102
    when 'Time'
103
      format_time(value)
104
    when 'Date'
105
      format_date(value)
122
    when 'Time', 'Date'
123
      format_date_yesterday_today_tomorrow(value)
106 124
    when 'Fixnum'
107 125
      if column.name == :id
108 126
        link_to value, issue_path(issue)
(2-2/2)