mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-23 09:16:10 +01:00
Add user preference to hide completed projects in the sidebar.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@320 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
6fa8439c4a
commit
d74635d229
6 changed files with 110 additions and 48 deletions
|
|
@ -65,6 +65,7 @@ class UserController < ApplicationController
|
|||
"week_starts" => "#{params['prefs']['week_starts']}",
|
||||
"no_completed" => "#{params['prefs']['no_completed']}",
|
||||
"staleness_starts" => "#{params['prefs']['staleness_starts']}",
|
||||
"show_completed_projects_on_home_page" => "#{params['prefs']['show_completed_projects_on_home_page']}",
|
||||
"due_style" => "#{params['prefs']['due_style']}",
|
||||
"admin_email" => "#{params['prefs']['admin_email']}",
|
||||
"refresh" => "#{params['prefs']['refresh']}"
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<% end -%>
|
||||
</ul>
|
||||
|
||||
<% if @user.preferences['show_completed_projects_on_home_page'].downcase == 'true' %>
|
||||
<h3>Completed Projects:</h3>
|
||||
<ul>
|
||||
<% for project in @projects.reject{|p| !p.done? } -%>
|
||||
|
|
@ -13,6 +14,7 @@
|
|||
:name => urlize(project.name) } ) + " (" + count_undone_todos(project,"actions") + ")" %></li>
|
||||
<% end -%>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<h3>Active Contexts:</h3>
|
||||
<ul>
|
||||
|
|
|
|||
|
|
@ -3,14 +3,15 @@
|
|||
<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>staleness_starts:</strong> the number of days before items with no due date get marked as stale (with a yellow highlight)</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>no_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>staleness starts:</strong> the number of days before items with no due date get marked as stale (with a yellow highlight)</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>no 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>
|
||||
<% 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>
|
||||
<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 %>
|
||||
<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>week starts:</strong> day of the week shown as the start of the week on the popup calendar.</li>
|
||||
<li><strong>show completed projects on home page:</strong> whether or not projects marked as complete are shown on the home page sidebar</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>refresh:</strong> automatic refresh interval for each of the pages (in minutes)</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -26,50 +27,94 @@
|
|||
<td><label>last name:</label></td>
|
||||
<td><%= text_field 'user', 'last_name' %></td>
|
||||
</tr>
|
||||
<% @prefs.each do |k,v| %>
|
||||
<% next if !@user.is_admin? and k == "admin_email" %>
|
||||
<tr>
|
||||
<td><label><%= k %>:</label></td>
|
||||
<td><label>week starts:</label></td>
|
||||
<td>
|
||||
<% case k
|
||||
when "week_starts" %>
|
||||
<select name="prefs[<%= k %>]" >
|
||||
<% day_num_to_name = { "0" => "Sunday",
|
||||
"1" => "Monday",
|
||||
"2" => "Tuesday",
|
||||
"3" => "Wednesday",
|
||||
"4" => "Thursday",
|
||||
"5" => "Friday",
|
||||
"6" => "Saturday"}
|
||||
day_num_to_name.sort.each do |number, day| %>
|
||||
<option value="<%= number%>"
|
||||
<% if number == v %>
|
||||
selected="true"
|
||||
<% end %>
|
||||
><%= day %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
<% when "due_style" %>
|
||||
<select name="prefs[<%= k %>]" >
|
||||
<option value="0"
|
||||
<% if v == "0" %>
|
||||
selected="true"
|
||||
<% end %>
|
||||
>Due in ___ days</option>
|
||||
|
||||
<option value="1"
|
||||
<% if v == "1" %>
|
||||
selected="true"
|
||||
<% end %>
|
||||
>Due on _______</option>
|
||||
</select>
|
||||
|
||||
<% else %>
|
||||
<input name="prefs[<%= k %>]" type="text" value="<%= v%>" >
|
||||
<% end %>
|
||||
</td>
|
||||
<select name="prefs[week_starts]" >
|
||||
<% day_num_to_name = { "0" => "Sunday",
|
||||
"1" => "Monday",
|
||||
"2" => "Tuesday",
|
||||
"3" => "Wednesday",
|
||||
"4" => "Thursday",
|
||||
"5" => "Friday",
|
||||
"6" => "Saturday"}
|
||||
day_num_to_name.sort.each do |number, day| %>
|
||||
<option value="<%= number%>"
|
||||
<% if number == @prefs['week_starts'] %>
|
||||
selected="true"
|
||||
<% end %>
|
||||
><%= day %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td><label>due style:</label></td>
|
||||
<td>
|
||||
<select name="prefs[due_style]" >
|
||||
<option value="0"
|
||||
<% if @prefs['due_style'] == "0" %>
|
||||
selected="true"
|
||||
<% end %>
|
||||
>Due in ___ days</option>
|
||||
|
||||
<option value="1"
|
||||
<% if @prefs['due_style'] == "1" %>
|
||||
selected="true"
|
||||
<% end %>
|
||||
>Due on _______</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label>show completed projects on home page:</label></td>
|
||||
<td>
|
||||
<select name="prefs[show_completed_projects_on_home_page]" >
|
||||
<option value="true"
|
||||
<% if @prefs['show_completed_projects_on_home_page'] == "true" %>
|
||||
selected="true"
|
||||
<% end %>
|
||||
>True</option>
|
||||
<option value="false"
|
||||
<% if @prefs['show_completed_projects_on_home_page'] == "false" %>
|
||||
selected="true"
|
||||
<% end %>
|
||||
>False</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<% if @user.is_admin? %>
|
||||
<tr>
|
||||
<td><label>admin email:</label></td>
|
||||
<td>
|
||||
<input name="prefs[admin_email]" type="text" value="<%= @prefs['admin_email'] %>" >
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td nowrap="true"><label>staleness starts:</label></td>
|
||||
<td>
|
||||
<input name="prefs[staleness_starts]" type="text" value="<%= @prefs['staleness_starts'] %>" >
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label>date format:</label></td>
|
||||
<td>
|
||||
<input name="prefs[date_format]" type="text" value="<%= @prefs['date_format'] %>" >
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label>no completed:</label></td>
|
||||
<td>
|
||||
<input name="prefs[no_completed]" type="text" value="<%= @prefs['no_completed'] %>" >
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label>refresh:</label></td>
|
||||
<td>
|
||||
<input name="prefs[refresh]" type="text" value="<%= @prefs['refresh'] %>" >
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td><%= submit_tag "Update" %></td>
|
||||
<td><%= link_to "Cancel", :controller => 'user', :action => 'preferences' %></td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
%>
|
||||
</span></li>
|
||||
<li>Show the last <span class="highlight"><%= @prefs["no_completed"] %></span> completed items on the home page</li>
|
||||
<li>Show completed projects on the home page: <span class="highlight"><%= @prefs["show_completed_projects_on_home_page"] %></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" %>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
class PrefToShowHideCompletedProjectsOnHomePage < ActiveRecord::Migration
|
||||
|
||||
def self.up
|
||||
@users = User.find(:all)
|
||||
@users.each do |user|
|
||||
user.preferences.merge!({"show_completed_projects_on_home_page" => true})
|
||||
user.save
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
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 => 10) do
|
||||
ActiveRecord::Schema.define(:version => 11) do
|
||||
|
||||
create_table "contexts", :force => true do |t|
|
||||
t.column "name", :string, :default => "", :null => false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue