Added a new preference which gives the user the option to see the full name of the project/context in an action listing instead of [P] or [C]. Defaults to false,

which is the same as the current behavior. 



git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@330 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2006-10-16 06:38:59 +00:00
parent c8f4f34f24
commit 3566040418
7 changed files with 29 additions and 3 deletions

View file

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

View file

@ -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? -%>

View file

@ -14,6 +14,7 @@
<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>show number completed:</strong> 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.</li>
<li><strong>refresh:</strong> automatic refresh interval for each of the pages (in minutes)</li>
<li><strong>verbose action descriptor:</strong> when true, show project/context name in action listing; when false show [P]/[C] with tool tips</li>
</ul>
</div>
@ -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") %>
<tr><td><%= submit_tag "Update" %></td>
<td><%= link_to "Cancel", :controller => 'user', :action => 'preferences' %></td>

View file

@ -28,6 +28,7 @@
<li>Admin email: <span class="highlight"><%= @prefs.admin_email %></span></li>
<% end %>
<li>Refresh interval (in minutes): <span class="highlight"><%= @prefs.refresh %></span></li>
<li>Verbose action descriptors: <span class="highlight"><%= @prefs.verbose_action_descriptors %></span></li>
</ul>
<%= link_to "Edit preferences", :controller => 'user', :action => 'edit_preferences' %> |
<%= link_to 'Change password', :controller => 'user', :action => 'change_password' %>

View file

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

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 => 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|

View file

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