Fixes #455 (cannot change due style in preferences). Thanks, lrbalt!

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@535 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-04-16 10:00:38 +00:00
parent bd9045c04f
commit ff28a733bd
5 changed files with 7 additions and 4 deletions

View file

@ -47,7 +47,7 @@ module ApplicationHelper
"<a title='#{format_date(due)}'><span class=\"amber\">Due Tomorrow</span></a> "
# due 2-7 days away
when 2..7
if @user.prefs.due_style == "1"
if @user.prefs.due_style == Preference::DUE_ON_DUE_STYLE
"<a title='#{format_date(due)}'><span class=\"orange\">Due on #{due.strftime("%A")}</span></a> "
else
"<a title='#{format_date(due)}'><span class=\"orange\">Due in #{pluralize(days, 'day')}</span></a> "

View file

@ -122,7 +122,7 @@ module TodosHelper
"<a title='" + format_date(due) + "'><span class=\"amber\">Show Tomorrow</span></a> "
# due 2-7 days away
when 2..7
if @user.prefs.due_style == 1
if @user.prefs.due_style == Preference::DUE_ON_DUE_STYLE
"<a title='" + format_date(due) + "'><span class=\"orange\">Show on " + due.strftime("%A") + "</span></a> "
else
"<a title='" + format_date(due) + "'><span class=\"orange\">Show in " + days.to_s + " days</span></a> "

View file

@ -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",

View file

@ -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") %>

View file

@ -16,7 +16,7 @@
<li>Go to project page on todo complete: <span class="highlight"><%= @prefs.show_project_on_todo_done %></span></li>
<li>Staleness starts after <span class="highlight"><%= @prefs.staleness_starts %></span> days</li>
<li>Due style: <span class="highlight">
<% if @prefs.due_style == "0" %>
<% if @prefs.due_style == Preference::DUE_IN_N_DAYS_DUE_STYLE %>
Due in ___ days
<% else %>
Due on ________