diff --git a/tracks/app/helpers/application_helper.rb b/tracks/app/helpers/application_helper.rb
index a7cc7860..d281f905 100644
--- a/tracks/app/helpers/application_helper.rb
+++ b/tracks/app/helpers/application_helper.rb
@@ -128,5 +128,16 @@ module ApplicationHelper
return count.to_s + " " + word
end
+ def item_link_to_context(item)
+ descriptor = "[C]"
+ descriptor = "[#{item.context.name}]" if (@user.preference.verbose_action_descriptors)
+ link_to( descriptor, { :controller => "context", :action => "show", :name => urlize(item.context.name) }, :title => "View context: #{item.context.name}" )
+ end
+
+ def item_link_to_project(item)
+ descriptor = "[P]"
+ descriptor = "[#{item.project.name}]" if (@user.preference.verbose_action_descriptors)
+ link_to( descriptor, { :controller => "project", :action => "show", :name => urlize(item.project.name) }, :title => "View project: #{item.project.name}" )
+ end
end
diff --git a/tracks/app/views/todo/_item.rhtml b/tracks/app/views/todo/_item.rhtml
index ca9d6cba..470ee970 100644
--- a/tracks/app/views/todo/_item.rhtml
+++ b/tracks/app/views/todo/_item.rhtml
@@ -17,9 +17,9 @@
(<%= item.context.name %><%= ", " + item.project.name if item.project_id %>)
<% else -%>
<% if parent_container_type == "project" -%>
- <%= link_to( "[C]", { :controller => "context", :action => "show", :name => urlize(item.context.name) }, :title => "View context: #{item.context.name}" ) %>
+ <%= item_link_to_context( item ) %>
<% elsif item.project_id -%>
- <%= link_to( "[P]", { :controller => "project", :action => "show", :name => urlize(item.project.name) }, :title => "View project: #{item.project.name}" ) %>
+ <%= item_link_to_project( item ) %>
<% end -%>
<% end -%>
<% if item.notes? -%>
diff --git a/tracks/app/views/user/preference_edit_form.rhtml b/tracks/app/views/user/preference_edit_form.rhtml
index 7ccbd66e..3dcccb3f 100644
--- a/tracks/app/views/user/preference_edit_form.rhtml
+++ b/tracks/app/views/user/preference_edit_form.rhtml
@@ -14,6 +14,7 @@
date format: 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 strftime manual for more formatting options for the date.
show number completed: number of completed actions to show on the home page. If you set this to zero, the completed actions box will not be shown on the home page or on the individual context or project pages. You can still see all your completed items by clicking the 'Done' link in the navigation bar at the top of each page.
refresh: automatic refresh interval for each of the pages (in minutes)
+ verbose action descriptor: when true, show project/context name in action listing; when false show [P]/[C] with tool tips
@@ -57,6 +58,7 @@
<%= row_with_text_field('date_format') %>
<%= row_with_text_field('show_number_completed') %>
<%= row_with_text_field('refresh') %>
+ <%= row_with_select_field("verbose_action_descriptors") %>
| <%= submit_tag "Update" %> |
<%= link_to "Cancel", :controller => 'user', :action => 'preferences' %> |
diff --git a/tracks/app/views/user/preferences.rhtml b/tracks/app/views/user/preferences.rhtml
index bdfef812..878f5c24 100644
--- a/tracks/app/views/user/preferences.rhtml
+++ b/tracks/app/views/user/preferences.rhtml
@@ -28,6 +28,7 @@
Admin email: <%= @prefs.admin_email %>
<% end %>
Refresh interval (in minutes): <%= @prefs.refresh %>
+ Verbose action descriptors: <%= @prefs.verbose_action_descriptors %>
<%= link_to "Edit preferences", :controller => 'user', :action => 'edit_preferences' %> |
<%= link_to 'Change password', :controller => 'user', :action => 'change_password' %>
diff --git a/tracks/db/migrate/015_add_verbose_action_descriptors_preference.rb b/tracks/db/migrate/015_add_verbose_action_descriptors_preference.rb
new file mode 100644
index 00000000..2944f8d9
--- /dev/null
+++ b/tracks/db/migrate/015_add_verbose_action_descriptors_preference.rb
@@ -0,0 +1,9 @@
+class AddVerboseActionDescriptorsPreference < ActiveRecord::Migration
+ def self.up
+ add_column :preferences, :verbose_action_descriptors, :boolean, :default => false, :null => false
+ end
+
+ def self.down
+ remove_column :preferences, :verbose_action_descriptors
+ end
+end
diff --git a/tracks/db/schema.rb b/tracks/db/schema.rb
index c3805237..f2d13e39 100644
--- a/tracks/db/schema.rb
+++ b/tracks/db/schema.rb
@@ -2,7 +2,7 @@
# migrations feature of ActiveRecord to incrementally modify your database, and
# then regenerate this schema definition.
-ActiveRecord::Schema.define(:version => 14) do
+ActiveRecord::Schema.define(:version => 15) do
create_table "contexts", :force => true do |t|
t.column "name", :string, :default => "", :null => false
@@ -30,6 +30,7 @@ ActiveRecord::Schema.define(:version => 14) do
t.column "due_style", :integer, :default => 0, :null => false
t.column "admin_email", :string, :default => "butshesagirl@rousette.org.uk", :null => false
t.column "refresh", :integer, :default => 0, :null => false
+ t.column "verbose_action_descriptors", :boolean, :default => false, :null => false
end
create_table "projects", :force => true do |t|
diff --git a/tracks/test/fixtures/preferences.yml b/tracks/test/fixtures/preferences.yml
index 52908c1c..a2412f5f 100644
--- a/tracks/test/fixtures/preferences.yml
+++ b/tracks/test/fixtures/preferences.yml
@@ -11,6 +11,7 @@ admin_user_prefs:
week_starts: 1
due_style: 0
refresh: 0
+ verbose_action_descriptors: true
other_user_prefs:
id: 2
@@ -24,3 +25,4 @@ other_user_prefs:
week_starts: 1
due_style: 0
refresh: 0
+ verbose_action_descriptors: false