Added a preference for the date format of the big date at the top of each page. Fixes #348.

Remember to rake db:migrate.



git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@460 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-02-27 02:42:37 +00:00
parent f4f1a3c1b7
commit 146c6a62f9
6 changed files with 18 additions and 3 deletions

View file

@ -27,7 +27,7 @@
<% if @count %>
<span id="badge_count" class="badge"><%= @count %></span>
<% end %>
<%= user_time.strftime("%A, %d %B %Y") %> <%= image_tag("spinner.gif", :size => "16X16", :border => 0, :id => 'busy', :style => 'display:none' ) %>
<%= user_time.strftime(@prefs.title_date_format) %> <%= image_tag("spinner.gif", :size => "16X16", :border => 0, :id => 'busy', :style => 'display:none' ) %>
</h1>
</div>
<div id="minilinks">

View file

@ -4,6 +4,7 @@
<ul>
<li><strong>first name and last name:</strong> Used for display purposes if set</li>
<li><strong>date format:</strong> the format in which you'd like dates to be shown. For example, for the date 31st January 2006, %d/%m/%Y will show 31/01/2006, %b-%e-%y will show Jan-31-06. See the <a href="http://uk2.php.net/strftime" title="PHP strftime manual">strftime manual</a> for more formatting options for the date.</li>
<li><strong>title date format:</strong> same as above, but for the big date at the top of each page.</li>
<li><strong>time zone:</strong> your local time zone</li>
<li><strong>week starts:</strong> day of the week shown as the start of the week on the popup calendar.</li>
<li><strong>due style:</strong> style in which due dates are shown, e.g. "Due in 3 days", "Due on Wednesday"</li>
@ -49,6 +50,7 @@
end
%>
<%= row_with_text_field('date_format') %>
<%= row_with_text_field('title_date_format') %>
<%= 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]})%>

View file

@ -5,7 +5,8 @@
<ul id="prefs">
<li>First name: <span class="highlight"><%= @user.first_name %></span></li>
<li>Last name: <span class="highlight"><%= @user.last_name %></span></li>
<li>Date format: <span class="highlight"><%= @prefs.date_format %></span> Your current date: <%= format_date Time.now.utc %></li>
<li>Date format: <span class="highlight"><%= @prefs.date_format %></span> Your current date: <%= format_date(user_time) %></li>
<li>Title date format: <span class="highlight"><%= @prefs.title_date_format %></span> Your current title date: <%= user_time.strftime(@prefs.title_date_format) %></li>
<li>Time zone: <span class="highlight"><%= @prefs.tz %></span> Your current time: <%= user_time.strftime('%I:%M %p') %></li>
<li>Week starts on: <span class="highlight"><%= Preference.day_number_to_name_map[@prefs.week_starts] %></span></li>
<li>Show the last <span class="highlight"><%= @prefs.show_number_completed %></span> completed items on the home page</li>

View file

@ -0,0 +1,9 @@
class AddTitleDateFormatPreference < ActiveRecord::Migration
def self.up
add_column :preferences, :title_date_format, :string, :limit => 255, :default => '%A, %d %B %Y', :null => false
end
def self.down
remove_column :preferences, :title_date_format
end
end

View file

@ -2,7 +2,7 @@
# migrations feature of ActiveRecord to incrementally modify your database, and
# then regenerate this schema definition.
ActiveRecord::Schema.define(:version => 28) do
ActiveRecord::Schema.define(:version => 29) do
create_table "contexts", :force => true do |t|
t.column "name", :string, :default => "", :null => false
@ -58,6 +58,7 @@ ActiveRecord::Schema.define(:version => 28) do
t.column "show_hidden_projects_in_sidebar", :boolean, :default => true, :null => false
t.column "time_zone", :string, :default => "London", :null => false
t.column "show_project_on_todo_done", :boolean, :default => false, :null => false
t.column "title_date_format", :string, :default => "%A, %d %B %Y", :null => false
end
add_index "preferences", ["user_id"], :name => "index_preferences_on_user_id"

View file

@ -4,6 +4,7 @@ admin_user_prefs:
user_id: 1
staleness_starts: 7
date_format: "%d/%m/%Y"
title_date_format: "%A, %d %B %Y"
show_number_completed: 5
show_completed_projects_in_sidebar: true
show_hidden_contexts_in_sidebar: true
@ -21,6 +22,7 @@ other_user_prefs:
user_id: 2
staleness_starts: 7
date_format: "%d/%m/%Y"
title_date_format: "%A, %d %B %Y"
show_number_completed: 5
show_completed_projects_in_sidebar: true
show_hidden_contexts_in_sidebar: true