diff --git a/tracks/app/helpers/application_helper.rb b/tracks/app/helpers/application_helper.rb index 676c3c3d..4280072f 100644 --- a/tracks/app/helpers/application_helper.rb +++ b/tracks/app/helpers/application_helper.rb @@ -47,7 +47,7 @@ module ApplicationHelper "Due Tomorrow " # due 2-7 days away when 2..7 - if @user.prefs.due_style == "1" + if @user.prefs.due_style == Preference::DUE_ON_DUE_STYLE "Due on #{due.strftime("%A")} " else "Due in #{pluralize(days, 'day')} " diff --git a/tracks/app/helpers/todos_helper.rb b/tracks/app/helpers/todos_helper.rb index 77d79673..4fe8b52a 100644 --- a/tracks/app/helpers/todos_helper.rb +++ b/tracks/app/helpers/todos_helper.rb @@ -122,7 +122,7 @@ module TodosHelper "Show Tomorrow " # due 2-7 days away when 2..7 - if @user.prefs.due_style == 1 + if @user.prefs.due_style == Preference::DUE_ON_DUE_STYLE "Show on " + due.strftime("%A") + " " else "Show in " + days.to_s + " days " diff --git a/tracks/app/models/preference.rb b/tracks/app/models/preference.rb index 19d9664e..3d22d73a 100644 --- a/tracks/app/models/preference.rb +++ b/tracks/app/models/preference.rb @@ -3,6 +3,9 @@ class Preference < ActiveRecord::Base composed_of :tz, :class_name => 'TimeZone', :mapping => %w(time_zone name) + + DUE_ON_DUE_STYLE = 1 + DUE_IN_N_DAYS_DUE_STYLE = 0 def self.day_number_to_name_map { 0 => "Sunday", diff --git a/tracks/app/views/preferences/edit.rhtml b/tracks/app/views/preferences/edit.rhtml index 7275de74..14605ea2 100644 --- a/tracks/app/views/preferences/edit.rhtml +++ b/tracks/app/views/preferences/edit.rhtml @@ -55,7 +55,7 @@ <%= table_row('time_zone', false) { time_zone_select('prefs','time_zone') } %> <%= row_with_select_field("week_starts", Preference.day_number_to_name_map.invert.sort{|a,b| a[1]<=>b[1]})%> - <%= row_with_select_field("due_style", [['Due in ___ days',0],['Due on _______',1]]) %> + <%= row_with_select_field("due_style", [['Due in ___ days',Preference::DUE_IN_N_DAYS_DUE_STYLE],['Due on _______',Preference::DUE_ON_DUE_STYLE]]) %> <%= row_with_select_field("show_completed_projects_in_sidebar") %> <%= row_with_select_field("show_hidden_projects_in_sidebar") %> <%= row_with_select_field("show_hidden_contexts_in_sidebar") %> diff --git a/tracks/app/views/preferences/index.rhtml b/tracks/app/views/preferences/index.rhtml index 4d7cb84a..2b96d3e0 100644 --- a/tracks/app/views/preferences/index.rhtml +++ b/tracks/app/views/preferences/index.rhtml @@ -16,7 +16,7 @@
  • Go to project page on todo complete: <%= @prefs.show_project_on_todo_done %>
  • Staleness starts after <%= @prefs.staleness_starts %> days
  • Due style: - <% if @prefs.due_style == "0" %> + <% if @prefs.due_style == Preference::DUE_IN_N_DAYS_DUE_STYLE %> Due in ___ days <% else %> Due on ________