mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-03 22:41:48 +01:00
Introduced a user preference for redirecting to an action's project page when you mark it complete. Defaults to false (no change from the current behavior of Tracks.) The idea of this feature is to go to the project detail page so you can see or create the next action. I'm interested in feedback from people who try this out.
Remember to rake migrate after you update. Fixes #38. Also, I added a display of the user's formatted date and current local time to the preferences page. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@445 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
48e9bcc33f
commit
439f955d32
13 changed files with 93 additions and 12 deletions
|
|
@ -3,12 +3,13 @@
|
|||
<p>The preference settings should mostly be self-explanatory, but some hints are included below: </p>
|
||||
<ul>
|
||||
<li><strong>first name and last name:</strong> Used for display purposes if set</li>
|
||||
<li><strong>time zone:</strong> your local time zone</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>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>
|
||||
<li><strong>show completed projects in sidebar:</strong> whether or not projects marked as complete are shown in the sidebar on the home page and elsewhere</li>
|
||||
<li><strong>show hidden contexts in sidebar:</strong> whether or not contexts marked as hidden are shown in the sidebar on the home page and elsewhere</li>
|
||||
<li><strong>show project on todo done:</strong> whether or not to redirect to the project page when an action associated with a project is marked complete</li>
|
||||
<% if @user.is_admin? %>
|
||||
<li><strong>admin email:</strong> email address for the admin user of Tracks (displayed on the signup page for users to contact to obtain an account)</li>
|
||||
<% end %>
|
||||
|
|
@ -47,15 +48,15 @@
|
|||
table_row(pref_name, nowrap_label) { text_field('prefs', pref_name) }
|
||||
end
|
||||
%>
|
||||
<%= row_with_text_field('date_format') %>
|
||||
<%= table_row('time_zone', false) { time_zone_select('prefs','time_zone') } %>
|
||||
|
||||
<%= row_with_text_field('date_format') %>
|
||||
<%= 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("show_completed_projects_in_sidebar") %>
|
||||
<%= row_with_select_field("show_hidden_projects_in_sidebar") %>
|
||||
<%= row_with_select_field("show_hidden_contexts_in_sidebar") %>
|
||||
|
||||
<%= row_with_select_field("show_project_on_todo_done") %>
|
||||
|
||||
<% if @user.is_admin? %> <%= row_with_text_field('admin_email') %> <% end %>
|
||||
<%= row_with_text_field('staleness_starts', true) %>
|
||||
|
|
|
|||
|
|
@ -5,13 +5,14 @@
|
|||
<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>Time zone: <span class="highlight"><%= @prefs.tz %></span></li>
|
||||
<li>Date format: <span class="highlight"><%= @prefs.date_format %></span></li>
|
||||
<li>Date format: <span class="highlight"><%= @prefs.date_format %></span> Your current date: <%= format_date Time.now.utc %></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>
|
||||
<li>Show completed projects in sidebar: <span class="highlight"><%= @prefs.show_completed_projects_in_sidebar %></span></li>
|
||||
<li>Show hidden projects in sidebar: <span class="highlight"><%= @prefs.show_hidden_projects_in_sidebar %></span></li>
|
||||
<li>Show hidden contexts in sidebar: <span class="highlight"><%= @prefs.show_hidden_contexts_in_sidebar %></span></li>
|
||||
<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" %>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ if @saved
|
|||
page[@todo].remove
|
||||
if @todo.completed?
|
||||
# Don't try to insert contents into a non-existent container!
|
||||
unless @user.prefs.hide_completed_actions?
|
||||
unless @prefs.hide_completed_actions?
|
||||
page.insert_html :top, "completed", :partial => 'todos/todo', :locals => { :parent_container_type => "completed" }
|
||||
page.visual_effect :highlight, dom_id(@todo, 'line'), {'startcolor' => "'#99ff99'"}
|
||||
page[empty_container_msg_div_id].show if @down_count == 0 && !empty_container_msg_div_id.nil?
|
||||
|
|
@ -21,6 +21,9 @@ if @saved
|
|||
end
|
||||
page.hide "status"
|
||||
page.replace_html "badge_count", @down_count
|
||||
if @todo.completed? && !@todo.project_id.nil? && @prefs.show_project_on_todo_done && !source_view_is(:project)
|
||||
page.redirect_to project_path(@todo.project_id)
|
||||
end
|
||||
else
|
||||
page.replace_html "status", content_tag("div", content_tag("h2", "#{pluralize(@todo.errors.count, "error")} prohibited this record from being saved") + content_tag("p", "There were problems with the following fields:") + content_tag("ul", @todo.errors.each_full { |msg| content_tag("li", msg) }), "id" => "errorExplanation", "class" => "errorExplanation")
|
||||
end
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
class AddShowProjectOnTodoDonePreference < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :preferences, :show_project_on_todo_done, :boolean, :default => false, :null => false
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :preferences, :show_project_on_todo_done
|
||||
end
|
||||
end
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
# migrations feature of ActiveRecord to incrementally modify your database, and
|
||||
# then regenerate this schema definition.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 27) do
|
||||
ActiveRecord::Schema.define(:version => 28) do
|
||||
|
||||
create_table "contexts", :force => true do |t|
|
||||
t.column "name", :string, :default => "", :null => false
|
||||
|
|
@ -57,6 +57,7 @@ ActiveRecord::Schema.define(:version => 27) do
|
|||
t.column "verbose_action_descriptors", :boolean, :default => false, :null => false
|
||||
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
|
||||
end
|
||||
|
||||
add_index "preferences", ["user_id"], :name => "index_preferences_on_user_id"
|
||||
|
|
|
|||
18
tracks/test/fixtures/contexts.yml
vendored
18
tracks/test/fixtures/contexts.yml
vendored
|
|
@ -86,3 +86,21 @@ waitingfor:
|
|||
user_id: 1
|
||||
created_at: <%= today %>
|
||||
updated_at: <%= today %>
|
||||
|
||||
office_otheruser:
|
||||
id: 10
|
||||
name: office
|
||||
position: 1
|
||||
hide: false
|
||||
user_id: 2
|
||||
created_at: <%= today %>
|
||||
updated_at: <%= today %>
|
||||
|
||||
waitingfor_otheruser:
|
||||
id: 11
|
||||
name: waiting for
|
||||
position: 2
|
||||
hide: false
|
||||
user_id: 2
|
||||
created_at: <%= today %>
|
||||
updated_at: <%= today %>
|
||||
|
|
|
|||
2
tracks/test/fixtures/preferences.yml
vendored
2
tracks/test/fixtures/preferences.yml
vendored
|
|
@ -14,6 +14,7 @@ admin_user_prefs:
|
|||
refresh: 0
|
||||
time_zone: "London"
|
||||
verbose_action_descriptors: true
|
||||
show_project_on_todo_done: false
|
||||
|
||||
other_user_prefs:
|
||||
id: 2
|
||||
|
|
@ -30,3 +31,4 @@ other_user_prefs:
|
|||
refresh: 0
|
||||
time_zone: "London"
|
||||
verbose_action_descriptors: false
|
||||
show_project_on_todo_done: true
|
||||
|
|
|
|||
10
tracks/test/fixtures/projects.yml
vendored
10
tracks/test/fixtures/projects.yml
vendored
|
|
@ -36,3 +36,13 @@ gardenclean:
|
|||
user_id: 1
|
||||
created_at: <%= today %>
|
||||
updated_at: <%= today %>
|
||||
|
||||
attendrailsconf:
|
||||
id: 4
|
||||
name: Attend RailsConf
|
||||
description: ''
|
||||
position: 1
|
||||
state: 'active'
|
||||
user_id: 2
|
||||
created_at: <%= today %>
|
||||
updated_at: <%= today %>
|
||||
|
|
|
|||
26
tracks/test/fixtures/todos.yml
vendored
26
tracks/test/fixtures/todos.yml
vendored
|
|
@ -200,3 +200,29 @@ end
|
|||
show_from: <%= next_week %>
|
||||
user_id: 1
|
||||
|
||||
16:
|
||||
id: 16
|
||||
context_id: 10
|
||||
project_id: 4
|
||||
description: Buy tix
|
||||
notes: ~
|
||||
state: active
|
||||
created_at: <%= today %>
|
||||
due: ~
|
||||
completed_at: ~
|
||||
show_from: <%= next_week %>
|
||||
user_id: 2
|
||||
|
||||
|
||||
17:
|
||||
id: 17
|
||||
context_id: 11
|
||||
project_id: 4
|
||||
description: Confirmation from pal
|
||||
notes: ~
|
||||
state: active
|
||||
created_at: <%= today %>
|
||||
due: ~
|
||||
completed_at: ~
|
||||
show_from: <%= next_week %>
|
||||
user_id: 2
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class ContextXmlApiTest < ActionController::IntegrationTest
|
|||
def test_creates_new_context
|
||||
initial_count = Context.count
|
||||
authenticated_post_xml_to_context_create
|
||||
assert_response_and_body_matches 200, %r|^<\?xml version="1.0" encoding="UTF-8"\?>\n<context>\n <created-at type=\"datetime\">\d{4}+-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z</created-at>\n <hide type="integer">0</hide>\n <id type="integer">\d+</id>\n <name>#{@@context_name}</name>\n <position type="integer">1</position>\n <updated-at type=\"datetime\">\d{4}+-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z</updated-at>\n</context>\n$|
|
||||
assert_response_and_body_matches 200, %r|^<\?xml version="1.0" encoding="UTF-8"\?>\n<context>\n <created-at type=\"datetime\">\d{4}+-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z</created-at>\n <hide type="integer">0</hide>\n <id type="integer">\d+</id>\n <name>#{@@context_name}</name>\n <position type="integer">3</position>\n <updated-at type=\"datetime\">\d{4}+-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z</updated-at>\n</context>\n$|
|
||||
assert_equal initial_count + 1, Context.count
|
||||
context1 = Context.find_by_name(@@context_name)
|
||||
assert_not_nil context1, "expected context '#{@@context_name}' to be created"
|
||||
|
|
|
|||
4
tracks/test/selenium/home/mark_todo_complete_3.rsel
Normal file
4
tracks/test/selenium/home/mark_todo_complete_3.rsel
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
setup :fixtures => :all
|
||||
include_partial 'login/login', :username => 'jane', :password => 'sesame'
|
||||
click_and_wait "xpath=//div[@id='c10'] //div[@id='todo_16'] //input[@class='item-checkbox']"
|
||||
assert_title "TRACKS::Project: Attend RailsConf"
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
setup :fixtures => :all
|
||||
next_available_todo_id = 18
|
||||
include_partial 'login/login', :username => 'admin', :password => 'abracadabra'
|
||||
open "/projects/Build_a_working_time_machine"
|
||||
include_partial 'project_detail/add_deferred_todo'
|
||||
open "/projects/Build_a_working_time_machine"
|
||||
click "edit_icon_todo_15"
|
||||
wait_for_element_present "show_from_todo_15"
|
||||
type "show_from_todo_15", ""
|
||||
click "edit_icon_todo_#{next_available_todo_id}"
|
||||
wait_for_element_present "show_from_todo_#{next_available_todo_id}"
|
||||
type "show_from_todo_#{next_available_todo_id}", ""
|
||||
click "//input[@value='Update']"
|
||||
wait_for_element_present "xpath=//div[@id='p1'] //div[@id='todo_15']"
|
||||
wait_for_element_present "xpath=//div[@id='p1'] //div[@id='todo_#{next_available_todo_id}']"
|
||||
assert_not_visible "tickler-empty-nd"
|
||||
assert_text 'badge_count', '3'
|
||||
|
|
|
|||
|
|
@ -14,5 +14,10 @@ class PreferenceTest < Test::Unit::TestCase
|
|||
assert_equal 'London', @admin_user.preference.time_zone
|
||||
assert_equal @admin_user.preference.tz, TimeZone['London']
|
||||
end
|
||||
|
||||
def test_show_project_on_todo_done
|
||||
assert @other_user.preference.show_project_on_todo_done
|
||||
assert !@admin_user.preference.show_project_on_todo_done
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue