Created
September 9, 2010 02:54
-
-
Save MischaTheEvil/571280 to your computer and use it in GitHub Desktop.
Patch to update Tracks to 1.7.1 in current BitNami Stack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: app/controllers/data_controller.rb | |
=================================================================== | |
--- app/controllers/data_controller.rb (revision 0) | |
+++ app/controllers/data_controller.rb (working copy) | |
@@ -18,25 +18,27 @@ | |
def yaml_export | |
all_tables = {} | |
- all_tables['todos'] = current_user.todos.find(:all) | |
+ all_tables['todos'] = current_user.todos.find(:all, :include => [:tags]) | |
all_tables['contexts'] = current_user.contexts.find(:all) | |
all_tables['projects'] = current_user.projects.find(:all) | |
- tags = Tag.find_by_sql([ | |
- "SELECT tags.* "+ | |
+ todo_tag_ids = Tag.find_by_sql([ | |
+ "SELECT DISTINCT tags.id "+ | |
"FROM tags, taggings, todos "+ | |
"WHERE todos.user_id=? "+ | |
"AND tags.id = taggings.tag_id " + | |
"AND taggings.taggable_id = todos.id ", current_user.id]) | |
+ rec_todo_tag_ids = Tag.find_by_sql([ | |
+ "SELECT DISTINCT tags.id "+ | |
+ "FROM tags, taggings, recurring_todos "+ | |
+ "WHERE recurring_todos.user_id=? "+ | |
+ "AND tags.id = taggings.tag_id " + | |
+ "AND taggings.taggable_id = recurring_todos.id ", current_user.id]) | |
+ tags = Tag.find(:all, :conditions => ["id IN (?) OR id IN (?)", todo_tag_ids, rec_todo_tag_ids]) | |
+ taggings = Tagging.find(:all, :conditions => ["tag_id IN (?) OR tag_id IN(?)", todo_tag_ids, rec_todo_tag_ids]) | |
+ | |
all_tables['tags'] = tags | |
- | |
- taggings = Tagging.find_by_sql([ | |
- "SELECT taggings.* "+ | |
- "FROM taggings, todos "+ | |
- "WHERE todos.user_id=? "+ | |
- "AND taggings.taggable_id = todos.id ", current_user.id]) | |
all_tables['taggings'] = taggings | |
- | |
all_tables['notes'] = current_user.notes.find(:all) | |
all_tables['recurring_todos'] = current_user.recurring_todos.find(:all) | |
@@ -52,22 +54,21 @@ | |
"Created at", "Due", "Completed at", "User ID", "Show from", | |
"state"] | |
current_user.todos.find(:all, :include => [:context, :project]).each do |todo| | |
- # Format dates in ISO format for easy sorting in spreadsheet Print | |
- # context and project names for easy viewing | |
- csv << [todo.id, todo.context.name, | |
- todo.project_id = todo.project_id.nil? ? "" : todo.project.name, | |
- todo.description, | |
+ csv << [todo.id, todo.context.name, | |
+ todo.project_id.nil? ? "" : todo.project.name, | |
+ todo.description, | |
todo.notes, todo.tags.collect{|t| t.name}.join(', '), | |
todo.created_at.to_formatted_s(:db), | |
- todo.due = todo.due? ? todo.due.to_formatted_s(:db) : "", | |
- todo.completed_at = todo.completed_at? ? todo.completed_at.to_formatted_s(:db) : "", | |
- todo.user_id, | |
- todo.show_from = todo.show_from? ? todo.show_from.to_formatted_s(:db) : "", | |
- todo.state] | |
+ todo.due? ? todo.due.to_formatted_s(:db) : "", | |
+ todo.completed_at? ? todo.completed_at.to_formatted_s(:db) : "", | |
+ todo.user_id, | |
+ todo.show_from? ? todo.show_from.to_formatted_s(:db) : "", | |
+ todo.state] | |
end | |
end | |
send_data(result, :filename => "todos.csv", :type => content_type) | |
end | |
+ | |
def csv_notes | |
content_type = 'text/csv' | |
@@ -90,15 +91,31 @@ | |
end | |
def xml_export | |
- result = "" | |
- result << current_user.todos.find(:all).to_xml | |
+ todo_tag_ids = Tag.find_by_sql([ | |
+ "SELECT DISTINCT tags.id "+ | |
+ "FROM tags, taggings, todos "+ | |
+ "WHERE todos.user_id=? "+ | |
+ "AND tags.id = taggings.tag_id " + | |
+ "AND taggings.taggable_id = todos.id ", current_user.id]) | |
+ rec_todo_tag_ids = Tag.find_by_sql([ | |
+ "SELECT DISTINCT tags.id "+ | |
+ "FROM tags, taggings, recurring_todos "+ | |
+ "WHERE recurring_todos.user_id=? "+ | |
+ "AND tags.id = taggings.tag_id " + | |
+ "AND taggings.taggable_id = recurring_todos.id ", current_user.id]) | |
+ tags = Tag.find(:all, :conditions => ["id IN (?) OR id IN (?)", todo_tag_ids, rec_todo_tag_ids]) | |
+ taggings = Tagging.find(:all, :conditions => ["tag_id IN (?) OR tag_id IN(?)", todo_tag_ids, rec_todo_tag_ids]) | |
+ | |
+ result = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><tracks_data>" | |
+ result << current_user.todos.find(:all).to_xml(:skip_instruct => true) | |
result << current_user.contexts.find(:all).to_xml(:skip_instruct => true) | |
result << current_user.projects.find(:all).to_xml(:skip_instruct => true) | |
- result << current_user.tags.find(:all).to_xml(:skip_instruct => true) | |
- result << current_user.taggings.find(:all).to_xml(:skip_instruct => true) | |
+ result << tags.to_xml(:skip_instruct => true) | |
+ result << taggings.to_xml(:skip_instruct => true) | |
result << current_user.notes.find(:all).to_xml(:skip_instruct => true) | |
result << current_user.recurring_todos.find(:all).to_xml(:skip_instruct => true) | |
- send_data(result, :filename => "tracks_backup.xml", :type => 'text/xml') | |
+ result << "</tracks_data>" | |
+ send_data(result, :filename => "tracks_data.xml", :type => 'text/xml') | |
end | |
def yaml_form | |
Index: app/controllers/projects_controller.rb | |
=================================================================== | |
--- app/controllers/projects_controller.rb (revision 0) | |
+++ app/controllers/projects_controller.rb (working copy) | |
@@ -163,6 +163,7 @@ | |
end | |
def destroy | |
+ @project.recurring_todos.each {|rt| rt.remove_from_project!} | |
@project.destroy | |
@active_projects_count = current_user.projects.active.count | |
@hidden_projects_count = current_user.projects.hidden.count | |
Index: app/controllers/todos_controller.rb | |
=================================================================== | |
--- app/controllers/todos_controller.rb (revision 0) | |
+++ app/controllers/todos_controller.rb (working copy) | |
@@ -33,7 +33,7 @@ | |
respond_to do |format| | |
format.m { | |
@new_mobile = true | |
- @return_path=cookies[:mobile_url] | |
+ @return_path=cookies[:mobile_url] ? cookies[:mobile_url] : mobile_path | |
@mobile_from_context = current_user.contexts.find_by_id(params[:from_context]) if params[:from_context] | |
@mobile_from_project = current_user.projects.find_by_id(params[:from_project]) if params[:from_project] | |
if params[:from_project] && !params[:from_context] | |
@@ -47,10 +47,21 @@ | |
def create | |
@source_view = params['_source_view'] || 'todo' | |
- p = TodoCreateParamsHelper.new(params, prefs) | |
- p.parse_dates() unless mobile? | |
+ @tag_name = params['_tag_name'] | |
+ | |
+ p = TodoCreateParamsHelper.new(params, prefs) | |
+ | |
+ date_error = false | |
+ begin | |
+ p.parse_dates() unless mobile? | |
+ rescue Exception => e | |
+ date_error = true | |
+ end | |
@todo = current_user.todos.build(p.attributes) | |
+ if date_error | |
+ @todo.errors.add :show_from, "date or due date is invalid" | |
+ end | |
if p.project_specified_by_name? | |
project = current_user.projects.find_or_create_by_name(p.project_name) | |
@@ -66,18 +77,19 @@ | |
end | |
@todo.update_state_from_project | |
- @saved = @todo.save | |
- unless (@saved == false) || p.tag_list.blank? | |
- @todo.tag_with(p.tag_list) | |
- @todo.tags.reload | |
+ | |
+ if @todo.errors.empty? | |
+ @saved = @todo.save | |
+ unless (@saved == false) || p.tag_list.blank? | |
+ @todo.tag_with(p.tag_list) | |
+ @todo.tags.reload | |
+ end | |
end | |
respond_to do |format| | |
format.html { redirect_to :action => "index" } | |
format.m do | |
- @return_path=cookies[:mobile_url] | |
- # todo: use function for this fixed path | |
- @return_path='/m' if @return_path.nil? | |
+ @return_path=cookies[:mobile_url] ? cookies[:mobile_url] : mobile_path | |
if @saved | |
redirect_to @return_path | |
else | |
@@ -120,7 +132,7 @@ | |
@projects = current_user.projects.active | |
@contexts = current_user.contexts.find(:all) | |
@edit_mobile = true | |
- @return_path=cookies[:mobile_url] | |
+ @return_path=cookies[:mobile_url] ? cookies[:mobile_url] : mobile_path | |
render :action => 'show' | |
end | |
format.xml { render :xml => @todo.to_xml( :root => 'todo', :except => :user_id ) } | |
@@ -132,6 +144,7 @@ | |
def toggle_check | |
@source_view = params['_source_view'] || 'todo' | |
@original_item_due = @todo.due | |
+ @original_item_was_deferred = @todo.deferred? | |
@saved = @todo.toggle_completion! | |
# check if this todo has a related recurring_todo. If so, create next todo | |
@@ -143,6 +156,7 @@ | |
determine_remaining_in_context_count(@todo.context_id) | |
determine_down_count | |
determine_completed_count if @todo.completed? | |
+ determine_deferred_tag_count(params['_tag_name']) if @source_view == 'tag' | |
if source_view_is :calendar | |
@original_item_due_id = get_due_id_for_calendar(@original_item_due) | |
@old_due_empty = is_old_due_empty(@original_item_due_id) | |
@@ -212,15 +226,28 @@ | |
end | |
params["todo"]["context_id"] = context.id | |
end | |
- | |
+ | |
+ due_date_valid = true | |
+ show_from_date_valid = true | |
+ | |
if params["todo"].has_key?("due") | |
- params["todo"]["due"] = parse_date_per_user_prefs(params["todo"]["due"]) | |
+ begin | |
+ params["todo"]["due"] = parse_date_per_user_prefs(params["todo"]["due"]) | |
+ rescue Exception | |
+ due_date_valid = false | |
+ params["todo"]["due"] = "" | |
+ end | |
else | |
params["todo"]["due"] = "" | |
end | |
if params['todo']['show_from'] | |
- params['todo']['show_from'] = parse_date_per_user_prefs(params['todo']['show_from']) | |
+ begin | |
+ params['todo']['show_from'] = parse_date_per_user_prefs(params['todo']['show_from']) | |
+ rescue Exception | |
+ show_from_date_valid = false | |
+ params["todo"]["show_from"] = "" | |
+ end | |
end | |
if params['done'] == '1' && [email protected]? | |
@@ -233,8 +260,14 @@ | |
end | |
@todo.attributes = params["todo"] | |
- @saved = @todo.save | |
+ @todo.errors.add :show_from, "date is invalid" unless show_from_date_valid | |
+ @todo.errors.add :due, "date is invalid" unless due_date_valid | |
+ | |
+ if @todo.errors.empty? | |
+ @saved = @todo.save | |
+ end | |
+ | |
@context_changed = @original_item_context_id != @todo.context_id | |
@todo_was_activated_from_deferred_state = @original_item_was_deferred && @todo.active? | |
@@ -264,14 +297,17 @@ | |
@remaining_undone_in_project = current_user.projects.find(@original_item_project_id).not_done_todo_count | |
end | |
determine_down_count | |
+ determine_deferred_tag_count(params['_tag_name']) if @source_view == 'tag' | |
+ | |
respond_to do |format| | |
format.js | |
format.xml { render :xml => @todo.to_xml( :except => :user_id ) } | |
format.m do | |
if @saved | |
if cookies[:mobile_url] | |
+ old_path = cookies[:mobile_url] | |
cookies[:mobile_url] = {:value => nil, :secure => SITE_CONFIG['secure_cookies']} | |
- redirect_to cookies[:mobile_url] | |
+ redirect_to old_path | |
else | |
redirect_to formatted_todos_path(:m) | |
end | |
@@ -303,7 +339,7 @@ | |
notify :error, "Failed to delete the action", 2.0 | |
redirect_to :action => 'index' | |
end | |
- end | |
+ end | |
format.js do | |
if @saved | |
@@ -311,7 +347,7 @@ | |
if source_view_is_one_of(:todo, :deferred) | |
determine_remaining_in_context_count(@context_id) | |
elsif source_view_is :calendar | |
- @original_item_due_id = get_due_id_for_calendar(@original_item_due) | |
+ @original_item_due_id = get_due_id_for_calendar(@original_item_due) | |
@old_due_empty = is_old_due_empty(@original_item_due_id) | |
end | |
end | |
@@ -391,22 +427,22 @@ | |
@tag = Tag.new(:name => @tag_name) if @tag.nil? | |
tag_collection = @tag.todos | |
- @not_done_todos = tag_collection.find(:all, | |
+ @not_done_todos = tag_collection.find(:all, | |
:conditions => ['todos.user_id = ? and state = ?', current_user.id, 'active'], | |
:order => 'todos.due IS NULL, todos.due ASC, todos.created_at ASC') | |
- @hidden_todos = current_user.todos.find(:all, | |
- :include => [:taggings, :tags, :context], | |
+ @hidden_todos = current_user.todos.find(:all, | |
+ :include => [:taggings, :tags, :context], | |
:conditions => ['tags.name = ? AND (todos.state = ? OR (contexts.hide = ? AND todos.state = ?))', @tag_name, 'project_hidden', true, 'active'], | |
:order => 'todos.completed_at DESC, todos.created_at DESC') | |
- @deferred = tag_collection.find(:all, | |
+ @deferred = tag_collection.find(:all, | |
:conditions => ['todos.user_id = ? and state = ?', current_user.id, 'deferred'], | |
:order => 'show_from ASC, todos.created_at DESC') | |
# If you've set no_completed to zero, the completed items box isn't shown on | |
# the tag page | |
max_completed = current_user.prefs.show_number_completed | |
- @done = tag_collection.find(:all, | |
- :limit => max_completed, | |
+ @done = tag_collection.find(:all, | |
+ :limit => max_completed, | |
:conditions => ['todos.user_id = ? and state = ?', current_user.id, 'completed'], | |
:order => 'todos.completed_at DESC') | |
@@ -416,15 +452,15 @@ | |
# Set count badge to number of items with this tag | |
@not_done_todos.empty? ? @count = 0 : @count = @not_done_todos.size | |
- @down_count = @count | |
+ @down_count = @count | |
respond_to do |format| | |
format.html { | |
@default_project_context_name_map = build_default_project_context_name_map(@projects).to_json | |
} | |
- format.m { | |
+ format.m { | |
cookies[:mobile_url]= {:value => request.request_uri, :secure => SITE_CONFIG['secure_cookies']} | |
- render :action => "mobile_tag" | |
+ render :action => "mobile_tag" | |
} | |
end | |
end | |
@@ -435,9 +471,14 @@ | |
@todo = Todo.find(params[:id]) | |
@todo.show_from = (@todo.show_from || @todo.user.date) + numdays.days | |
@saved = @todo.save | |
- | |
+ | |
determine_down_count | |
determine_remaining_in_context_count(@todo.context_id) | |
+ if @source_view == 'project' | |
+ @remaining_undone_in_project = current_user.projects.find(@todo.project_id).not_done_todo_count | |
+ @original_item_project_id = @todo.project_id | |
+ end | |
+ | |
respond_to do |format| | |
format.html { redirect_to :back } | |
format.js {render :action => 'update'} | |
@@ -447,30 +488,33 @@ | |
def calendar | |
@source_view = params['_source_view'] || 'calendar' | |
@page_title = "TRACKS::Calendar" | |
- | |
+ | |
+ @projects = current_user.projects.find(:all) | |
+ @default_project_context_name_map = build_default_project_context_name_map(@projects).to_json | |
+ | |
due_today_date = Time.zone.now | |
due_this_week_date = Time.zone.now.end_of_week | |
due_next_week_date = due_this_week_date + 7.days | |
due_this_month_date = Time.zone.now.end_of_month | |
@due_today = current_user.todos.not_completed.find(:all, | |
- :include => [:taggings, :tags], | |
+ :include => [:taggings, :tags], | |
:conditions => ['todos.due <= ?', due_today_date], | |
:order => "due") | |
@due_this_week = current_user.todos.not_completed.find(:all, | |
- :include => [:taggings, :tags], | |
+ :include => [:taggings, :tags], | |
:conditions => ['todos.due > ? AND todos.due <= ?', due_today_date, due_this_week_date], | |
:order => "due") | |
@due_next_week = current_user.todos.not_completed.find(:all, | |
- :include => [:taggings, :tags], | |
+ :include => [:taggings, :tags], | |
:conditions => ['todos.due > ? AND todos.due <= ?', due_this_week_date, due_next_week_date], | |
:order => "due") | |
@due_this_month = current_user.todos.not_completed.find(:all, | |
- :include => [:taggings, :tags], | |
+ :include => [:taggings, :tags], | |
:conditions => ['todos.due > ? AND todos.due <= ?', due_next_week_date, due_this_month_date], | |
:order => "due") | |
@due_after_this_month = current_user.todos.not_completed.find(:all, | |
- :include => [:taggings, :tags], | |
+ :include => [:taggings, :tags], | |
:conditions => ['todos.due > ?', due_this_month_date], | |
:order => "due") | |
@@ -483,7 +527,7 @@ | |
render :action => 'calendar', :layout => false, :content_type => Mime::ICS | |
} | |
end | |
- end | |
+ end | |
private | |
@@ -494,7 +538,7 @@ | |
def init | |
@source_view = params['_source_view'] || 'todo' | |
init_data_for_sidebar unless mobile? | |
- init_todos | |
+ init_todos | |
end | |
def with_feed_query_scope(&block) | |
@@ -563,7 +607,7 @@ | |
end | |
else | |
yield | |
- end | |
+ end | |
end | |
def with_limit_scope(&block) | |
@@ -589,7 +633,7 @@ | |
with_limit_scope do | |
if mobile? | |
- init_todos_for_mobile_view | |
+ init_todos_for_mobile_view | |
else | |
# Note: these next two finds were previously using | |
@@ -599,10 +643,10 @@ | |
@todos = Todo.find(:all, :conditions => ['todos.user_id = ?', current_user.id], :include => [ :project, :context, :tags ]) | |
# Exclude hidden projects from the home page | |
- @not_done_todos = Todo.find(:all, | |
- :conditions => ['todos.user_id = ? AND contexts.hide = ? AND (projects.state = ? OR todos.project_id IS NULL)', | |
- current_user.id, false, 'active'], | |
- :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC", | |
+ @not_done_todos = Todo.find(:all, | |
+ :conditions => ['todos.user_id = ? AND contexts.hide = ? AND (projects.state = ? OR todos.project_id IS NULL)', | |
+ current_user.id, false, 'active'], | |
+ :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC", | |
:include => [ :project, :context, :tags ]) | |
end | |
@@ -616,10 +660,10 @@ | |
# but that broke with_scope for :limit | |
# Exclude hidden projects from the home page | |
- @not_done_todos = Todo.find(:all, | |
- :conditions => ['todos.user_id = ? AND todos.state = ? AND contexts.hide = ? AND (projects.state = ? OR todos.project_id IS NULL)', | |
- current_user.id, 'active', false, 'active'], | |
- :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC", | |
+ @not_done_todos = Todo.find(:all, | |
+ :conditions => ['todos.user_id = ? AND todos.state = ? AND contexts.hide = ? AND (projects.state = ? OR todos.project_id IS NULL)', | |
+ current_user.id, 'active', false, 'active'], | |
+ :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC", | |
:include => [ :project, :context, :tags ]) | |
end | |
@@ -627,8 +671,8 @@ | |
source_view do |from| | |
from.todo do | |
@down_count = Todo.count( | |
- :all, | |
- :conditions => ['todos.user_id = ? and todos.state = ? and contexts.hide = ? AND (projects.state = ? OR todos.project_id IS NULL)', current_user.id, 'active', false, 'active'], | |
+ :all, | |
+ :conditions => ['todos.user_id = ? and todos.state = ? and contexts.hide = ? AND (projects.state = ? OR todos.project_id IS NULL)', current_user.id, 'active', false, 'active'], | |
:include => [ :project, :context ]) | |
# #@down_count = Todo.count_by_sql(['SELECT COUNT(*) FROM todos, | |
# contexts WHERE todos.context_id = contexts.id and todos.user_id = ? | |
@@ -658,12 +702,12 @@ | |
@not_done_todos.empty? ? @down_count = 0 : @down_count = @not_done_todos.size | |
end | |
end | |
- end | |
+ end | |
def determine_remaining_in_context_count(context_id = @todo.context_id) | |
source_view do |from| | |
from.deferred { @remaining_in_context = current_user.contexts.find(context_id).deferred_todo_count } | |
- from.tag { | |
+ from.tag { | |
tag = Tag.find_by_name(params['_tag_name']) | |
if tag.nil? | |
tag = Tag.new(:name => params['tag']) | |
@@ -672,7 +716,7 @@ | |
} | |
end | |
@remaining_in_context = current_user.contexts.find(context_id).not_done_todo_count if @remaining_in_context.nil? | |
- end | |
+ end | |
def determine_completed_count | |
source_view do |from| | |
@@ -690,6 +734,18 @@ | |
end | |
end | |
+ def determine_deferred_tag_count(tag) | |
+ tags = Tag.find_by_name(tag) | |
+ if tags.nil? | |
+ # should normally not happen, but is a workaround for #929 | |
+ @deferred_tag_count = 0 | |
+ else | |
+ @deferred_tag_count = tags.todos.count(:all, | |
+ :conditions => ['todos.user_id = ? and state = ?', current_user.id, 'deferred'], | |
+ :order => 'show_from ASC, todos.created_at DESC') | |
+ end | |
+ end | |
+ | |
def render_todos_html | |
lambda do | |
@page_title = "TRACKS::List tasks" | |
@@ -821,7 +877,7 @@ | |
end | |
end | |
end | |
- return new_recurring_todo | |
+ return new_recurring_todo | |
end | |
def get_due_id_for_calendar(due) | |
@@ -862,11 +918,11 @@ | |
when "due_this_month" | |
return 0 == current_user.todos.not_completed.count(:all, | |
:conditions => ['todos.due > ? AND todos.due <= ?', due_next_week_date, due_this_month_date]) | |
- when "due_after_this_month" | |
+ when "due_after_this_month" | |
return 0 == current_user.todos.not_completed.count(:all, | |
:conditions => ['todos.due > ?', due_this_month_date]) | |
else | |
- raise Exception.new, "unknown due id for calendar: '#{id}'" | |
+ raise Exception.new, "unknown due id for calendar: '#{id}'" | |
end | |
end | |
Index: app/controllers/users_controller.rb | |
=================================================================== | |
--- app/controllers/users_controller.rb (revision 0) | |
+++ app/controllers/users_controller.rb (working copy) | |
@@ -3,8 +3,7 @@ | |
skip_before_filter :login_required, :only => [ :new, :create ] | |
prepend_before_filter :login_optional, :only => [ :new, :create ] | |
- # GET /users | |
- # GET /users.xml | |
+ # GET /users GET /users.xml | |
def index | |
@users = User.find(:all, :order => 'login') | |
respond_to do |format| | |
@@ -12,18 +11,17 @@ | |
@page_title = "TRACKS::Manage Users" | |
@users = User.paginate :page => params[:page], :order => 'login ASC' | |
@total_users = User.count | |
- # When we call users/signup from the admin page | |
- # we store the URL so that we get returned here when signup is successful | |
+ # When we call users/signup from the admin page we store the URL so that | |
+ # we get returned here when signup is successful | |
store_location | |
end | |
format.xml { render :xml => @users.to_xml(:except => [ :password ]) } | |
end | |
end | |
- # GET /users/somelogin | |
- # GET /users/somelogin.xml | |
+ # GET /users/id GET /users/id.xml | |
def show | |
- @user = User.find_by_login(params[:id]) | |
+ @user = User.find_by_id(params[:id]) | |
render :xml => @user.to_xml(:except => [ :password ]) | |
end | |
@@ -46,13 +44,13 @@ | |
render :layout => "login" | |
end | |
- # Example usage: curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' | |
+ # Example usage: curl -H 'Accept: application/xml' -H 'Content-Type: | |
+ # application/xml' | |
# -u admin:up2n0g00d | |
# -d '<request><login>username</login><password>abc123</password></request>' | |
# http://our.tracks.host/users | |
# | |
- # POST /users | |
- # POST /users.xml | |
+ # POST /users POST /users.xml | |
def create | |
if params['exception'] | |
render_failure "Expected post format is valid xml like so: <request><login>username</login><password>abc123</password></request>." | |
@@ -107,10 +105,9 @@ | |
end | |
end | |
- # DELETE /users/somelogin | |
- # DELETE /users/somelogin.xml | |
+ # DELETE /users/id DELETE /users/id.xml | |
def destroy | |
- @deleted_user = User.find_by_login(params[:id]) | |
+ @deleted_user = User.find_by_id(params[:id]) | |
@saved = @deleted_user.destroy | |
@total_users = User.find(:all).size | |
@@ -150,9 +147,8 @@ | |
if (params[:open_id_complete] || (params[:user][:auth_type] == 'open_id')) && openid_enabled? | |
authenticate_with_open_id do |result, identity_url| | |
if result.successful? | |
- # Success means that the transaction completed without | |
- # error. If info is nil, it means that the user cancelled | |
- # the verification. | |
+ # Success means that the transaction completed without error. If info | |
+ # is nil, it means that the user cancelled the verification. | |
@user.auth_type = 'open_id' | |
@user.open_id_url = identity_url | |
if @user.save | |
@@ -207,5 +203,4 @@ | |
return true | |
end | |
- | |
end | |
\ No newline at end of file | |
Index: app/helpers/todos_helper.rb | |
=================================================================== | |
--- app/helpers/todos_helper.rb (revision 0) | |
+++ app/helpers/todos_helper.rb (working copy) | |
@@ -1,287 +1,299 @@ | |
-module TodosHelper | |
- | |
- # #require 'users_controller' Counts the number of incomplete items in the | |
- # specified context | |
- # | |
- def count_items(context) | |
- count = Todo.find_all("done=0 AND context_id=#{context.id}").length | |
- end | |
- | |
- def form_remote_tag_edit_todo( &block ) | |
- form_tag( | |
- todo_path(@todo), { | |
- :method => :put, | |
- :id => dom_id(@todo, 'form'), | |
- :class => dom_id(@todo, 'form') + " inline-form edit_todo_form" }, | |
- &block ) | |
- apply_behavior 'form.edit_todo_form', make_remote_form( | |
- :method => :put, | |
- :before => "this.down('button.positive').startWaiting()", | |
- :loaded => "this.down('button.positive').stopWaiting()", | |
- :condition => "!(this.down('button.positive').isWaiting())"), | |
- :prevent_default => true | |
- end | |
- | |
- def set_behavior_for_delete_icon | |
- parameters = "_source_view=#{@source_view}" | |
- parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag' | |
- apply_behavior '.item-container a.delete_icon:click', :prevent_default => true do |page| | |
- page.confirming "'Are you sure that you want to ' + this.title + '?'" do | |
- page << "itemContainer = this.up('.item-container'); itemContainer.startWaiting();" | |
- page << remote_to_href(:method => 'delete', :with => "'#{parameters}'", :complete => "itemContainer.stopWaiting();") | |
- end | |
- end | |
- end | |
- | |
- def remote_delete_icon | |
- str = link_to( image_tag_for_delete, | |
- todo_path(@todo), :id => "delete_icon_"[email protected]_s, | |
- :class => "icon delete_icon", :title => "delete the action '#{@todo.description}'") | |
- set_behavior_for_delete_icon | |
- str | |
- end | |
- | |
- def set_behavior_for_star_icon | |
- apply_behavior '.item-container a.star_item:click', | |
- remote_to_href(:method => 'put', :with => "{ _source_view : '#{@source_view}' }"), | |
- :prevent_default => true | |
- end | |
- | |
- def remote_star_icon | |
- str = link_to( image_tag_for_star(@todo), | |
- toggle_star_todo_path(@todo), | |
- :class => "icon star_item", :title => "star the action '#{@todo.description}'") | |
- set_behavior_for_star_icon | |
- str | |
- end | |
- | |
- def set_behavior_for_edit_icon | |
- parameters = "_source_view=#{@source_view}" | |
- parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag' | |
- apply_behavior '.item-container a.edit_icon:click', :prevent_default => true do |page| | |
- page << "Effect.Pulsate(this);" | |
- page << remote_to_href(:method => 'get', :with => "'#{parameters}'") | |
- end | |
- end | |
- | |
- def remote_edit_icon | |
- if [email protected]? | |
- str = link_to( image_tag_for_edit(@todo), | |
- edit_todo_path(@todo), | |
- :class => "icon edit_icon") | |
- set_behavior_for_edit_icon | |
- else | |
- str = '<a class="icon">' + image_tag("blank.png") + "</a> " | |
- end | |
- str | |
- end | |
- | |
- def set_behavior_for_toggle_checkbox | |
- parameters = "_source_view=#{@source_view}" | |
- parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag' | |
- apply_behavior '.item-container input.item-checkbox:click', | |
- remote_function(:url => javascript_variable('this.value'), :method => 'put', | |
- :with => "'#{parameters}'") | |
- end | |
- | |
- def remote_toggle_checkbox | |
- str = check_box_tag('item_id', toggle_check_todo_path(@todo), @todo.completed?, :class => 'item-checkbox') | |
- set_behavior_for_toggle_checkbox | |
- str | |
- end | |
- | |
- def date_span | |
- if @todo.completed? | |
- "<span class=\"grey\">#{format_date( @todo.completed_at )}</span>" | |
- elsif @todo.deferred? | |
- show_date( @todo.show_from ) | |
- else | |
- due_date( @todo.due ) | |
- end | |
- end | |
- | |
- def tag_list_text | |
- @todo.tags.collect{|t| t.name}.join(', ') | |
- end | |
- | |
- def tag_list | |
- tags_except_starred = @todo.tags.reject{|t| t.name == Todo::STARRED_TAG_NAME} | |
- tag_list = tags_except_starred.collect{|t| "<span class=\"tag #{t.name.gsub(' ','-')}\">" + link_to(t.name, :controller => "todos", :action => "tag", :id => t.name) + "</span>"}.join('') | |
- "<span class='tags'>#{tag_list}</span>" | |
- end | |
- | |
- def tag_list_mobile | |
- tags_except_starred = @todo.tags.reject{|t| t.name == Todo::STARRED_TAG_NAME} | |
- # removed the link. TODO: add link to mobile view of tagged actions | |
- tag_list = tags_except_starred.collect{|t| | |
- "<span class=\"tag\">" + | |
- link_to(t.name, {:action => "tag", :controller => "todos", :id => t.name+".m"}) + | |
- "</span>"}.join('') | |
- if tag_list.empty? then "" else "<span class=\"tags\">#{tag_list}</span>" end | |
- end | |
- | |
- def deferred_due_date | |
- if @todo.deferred? && @todo.due | |
- "(action due on #{format_date(@todo.due)})" | |
- end | |
- end | |
- | |
- def project_and_context_links(parent_container_type, opts = {}) | |
- str = '' | |
- if @todo.completed? | |
- str += @todo.context.name unless opts[:suppress_context] | |
- should_suppress_project = opts[:suppress_project] || @todo.project.nil? | |
- str += ", " unless str.blank? || should_suppress_project | |
- str += @todo.project.name unless should_suppress_project | |
- str = "(#{str})" unless str.blank? | |
- else | |
- if (['project', 'tag', 'stats', 'search'].include?(parent_container_type)) | |
- str << item_link_to_context( @todo ) | |
- end | |
- if (['context', 'tickler', 'tag', 'stats', 'search'].include?(parent_container_type)) && @todo.project_id | |
- str << item_link_to_project( @todo ) | |
- end | |
- end | |
- return str | |
- end | |
- | |
- # Uses the 'staleness_starts' value from settings.yml (in days) to colour the | |
- # background of the action appropriately according to the age of the creation | |
- # date: | |
- # * l1: created more than 1 x staleness_starts, but < 2 x staleness_starts | |
- # * l2: created more than 2 x staleness_starts, but < 3 x staleness_starts | |
- # * l3: created more than 3 x staleness_starts | |
- # | |
- def staleness_class(item) | |
- if item.due || item.completed? | |
- return "" | |
- elsif item.created_at < user_time - (prefs.staleness_starts * 3).days | |
- return " stale_l3" | |
- elsif item.created_at < user_time - (prefs.staleness_starts * 2).days | |
- return " stale_l2" | |
- elsif item.created_at < user_time - (prefs.staleness_starts).days | |
- return " stale_l1" | |
- else | |
- return "" | |
- end | |
- end | |
- | |
- # Check show_from date in comparison to today's date Flag up date | |
- # appropriately with a 'traffic light' colour code | |
- # | |
- def show_date(d) | |
- if d == nil | |
- return "" | |
- end | |
- | |
- days = days_from_today(d) | |
- | |
- case days | |
- # overdue or due very soon! sound the alarm! | |
- when -1000..-1 | |
- "<a title=\"" + format_date(d) + "\"><span class=\"red\">Scheduled to show " + (days * -1).to_s + " days ago</span></a> " | |
- when 0 | |
- "<a title=\"" + format_date(d) + "\"><span class=\"amber\">Show Today</span></a> " | |
- when 1 | |
- "<a title=\"" + format_date(d) + "\"><span class=\"amber\">Show Tomorrow</span></a> " | |
- # due 2-7 days away | |
- when 2..7 | |
- if prefs.due_style == Preference.due_styles[:due_on] | |
- "<a title=\"" + format_date(d) + "\"><span class=\"orange\">Show on " + d.strftime("%A") + "</span></a> " | |
- else | |
- "<a title=\"" + format_date(d) + "\"><span class=\"orange\">Show in " + days.to_s + " days</span></a> " | |
- end | |
- # more than a week away - relax | |
- else | |
- "<a title=\"" + format_date(d) + "\"><span class=\"green\">Show in " + days.to_s + " days</span></a> " | |
- end | |
- end | |
- | |
- def calendar_setup( input_field ) | |
- str = "Calendar.setup({ ifFormat:\"#{prefs.date_format}\"" | |
- str << ",firstDay:#{prefs.week_starts},showOthers:true,range:[2004, 2010]" | |
- str << ",step:1,inputField:\"" + input_field + "\",cache:true,align:\"TR\" })\n" | |
- javascript_tag str | |
- end | |
- | |
- def item_container_id (todo) | |
- if source_view_is :project | |
- return "p#{todo.project_id}" if todo.active? | |
- return "tickler" if todo.deferred? | |
- end | |
- return "c#{todo.context_id}" | |
- end | |
- | |
- def should_show_new_item | |
- | |
- if @todo.project.nil? == false | |
- # do not show new actions that were added to hidden or completed projects | |
- # on home page and context page | |
- return false if source_view_is(:todo) && (@todo.project.hidden? || @todo.project.completed?) | |
- return false if source_view_is(:context) && (@todo.project.hidden? || @todo.project.completed?) | |
- end | |
- | |
- return true if source_view_is(:deferred) && @todo.deferred? | |
- return true if source_view_is(:project) && @todo.project.hidden? && @todo.project_hidden? | |
- return true if source_view_is(:project) && @todo.deferred? | |
- return true if !source_view_is(:deferred) && @todo.active? | |
- return false | |
- end | |
- | |
- def parent_container_type | |
- return 'tickler' if source_view_is :deferred | |
- return 'project' if source_view_is :project | |
- return 'stats' if source_view_is :stats | |
- return 'context' | |
- end | |
- | |
- def empty_container_msg_div_id | |
- return "tickler-empty-nd" if source_view_is(:project) && @todo.deferred? | |
- return "p#{@todo.project_id}empty-nd" if source_view_is :project | |
- return "c#{@todo.context_id}empty-nd" | |
- end | |
- | |
- def project_names_for_autocomplete | |
- array_or_string_for_javascript( ['None'] + current_user.projects.active.collect{|p| escape_javascript(p.name) } ) | |
- end | |
- | |
- def context_names_for_autocomplete | |
- # #return array_or_string_for_javascript(['Create a new context']) if | |
- # @contexts.empty? | |
- array_or_string_for_javascript( current_user.contexts.collect{|c| escape_javascript(c.name) } ) | |
- end | |
- | |
- def format_ical_notes(notes) | |
- split_notes = notes.split(/\n/) | |
- joined_notes = split_notes.join("\\n") | |
- end | |
- | |
- def formatted_pagination(total) | |
- s = will_paginate(@todos) | |
- (s.gsub(/(<\/[^<]+>)/, '\1 ')).chomp(' ') | |
- end | |
- | |
- def date_field_tag(name, id, value = nil, options = {}) | |
- text_field_tag name, value, {"size" => 12, "id" => id, "class" => "Date", "onfocus" => "Calendar.setup", "autocomplete" => "off"}.update(options.stringify_keys) | |
- end | |
- | |
- private | |
- | |
- def image_tag_for_delete | |
- image_tag("blank.png", :title =>"Delete action", :class=>"delete_item") | |
- end | |
- | |
- def image_tag_for_edit(todo) | |
- image_tag("blank.png", :title =>"Edit action", :class=>"edit_item", :id=> dom_id(todo, 'edit_icon')) | |
- end | |
- | |
- def image_tag_for_star(todo) | |
- class_str = todo.starred? ? "starred_todo" : "unstarred_todo" | |
- image_tag("blank.png", :title =>"Star action", :class => class_str) | |
- end | |
- | |
- def defer_link(days) | |
- link_to_remote image_tag("defer_#{days}.png", :alt => "Defer #{pluralize(days, 'day')}"), :url => {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => days, :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")} | |
- end | |
- | |
-end | |
+module TodosHelper | |
+ | |
+ # #require 'users_controller' Counts the number of incomplete items in the | |
+ # specified context | |
+ # | |
+ def count_items(context) | |
+ count = Todo.find_all("done=0 AND context_id=#{context.id}").length | |
+ end | |
+ | |
+ def form_remote_tag_edit_todo( &block ) | |
+ form_tag( | |
+ todo_path(@todo), { | |
+ :method => :put, | |
+ :id => dom_id(@todo, 'form'), | |
+ :class => dom_id(@todo, 'form') + " inline-form edit_todo_form" }, | |
+ &block ) | |
+ apply_behavior 'form.edit_todo_form', make_remote_form( | |
+ :method => :put, | |
+ :before => "todoSpinner = this.down('button.positive'); todoSpinner.startWaiting()", | |
+ :loaded => "todoSpinner.stopWaiting()", | |
+ :condition => "!(this.down('button.positive').isWaiting())"), | |
+ :prevent_default => true | |
+ end | |
+ | |
+ def set_behavior_for_delete_icon | |
+ parameters = "_source_view=#{@source_view}" | |
+ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag' | |
+ apply_behavior '.item-container a.delete_icon:click', :prevent_default => true do |page| | |
+ page.confirming "'Are you sure that you want to ' + this.title + '?'" do | |
+ page << "itemContainer = this.up('.item-container'); itemContainer.startWaiting();" | |
+ page << remote_to_href(:method => 'delete', :with => "'#{parameters}'", :complete => "itemContainer.stopWaiting();") | |
+ end | |
+ end | |
+ end | |
+ | |
+ def remote_delete_icon | |
+ str = link_to( image_tag_for_delete, | |
+ todo_path(@todo), :id => "delete_icon_"[email protected]_s, | |
+ :class => "icon delete_icon", :title => "delete the action '#{@todo.description}'") | |
+ set_behavior_for_delete_icon | |
+ str | |
+ end | |
+ | |
+ def set_behavior_for_star_icon | |
+ apply_behavior '.item-container a.star_item:click', | |
+ remote_to_href(:method => 'put', :with => "{ _source_view : '#{@source_view}' }"), | |
+ :prevent_default => true | |
+ end | |
+ | |
+ def remote_star_icon | |
+ str = link_to( image_tag_for_star(@todo), | |
+ toggle_star_todo_path(@todo), | |
+ :class => "icon star_item", :title => "star the action '#{@todo.description}'") | |
+ set_behavior_for_star_icon | |
+ str | |
+ end | |
+ | |
+ def set_behavior_for_edit_icon | |
+ parameters = "_source_view=#{@source_view}" | |
+ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag' | |
+ apply_behavior '.item-container a.edit_icon:click', :prevent_default => true do |page| | |
+ page << "Effect.Pulsate(this);" | |
+ page << remote_to_href(:method => 'get', :with => "'#{parameters}'") | |
+ end | |
+ end | |
+ | |
+ def remote_edit_icon | |
+ if [email protected]? | |
+ str = link_to( image_tag_for_edit(@todo), | |
+ edit_todo_path(@todo), | |
+ :class => "icon edit_icon") | |
+ set_behavior_for_edit_icon | |
+ else | |
+ str = '<a class="icon">' + image_tag("blank.png") + "</a> " | |
+ end | |
+ str | |
+ end | |
+ | |
+ def set_behavior_for_toggle_checkbox | |
+ parameters = "_source_view=#{@source_view}" | |
+ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag' | |
+ apply_behavior '.item-container input.item-checkbox:click', | |
+ remote_function(:url => javascript_variable('this.value'), :method => 'put', | |
+ :with => "'#{parameters}'") | |
+ end | |
+ | |
+ def remote_toggle_checkbox | |
+ str = check_box_tag('item_id', toggle_check_todo_path(@todo), @todo.completed?, :class => 'item-checkbox') | |
+ set_behavior_for_toggle_checkbox | |
+ str | |
+ end | |
+ | |
+ def date_span | |
+ if @todo.completed? | |
+ "<span class=\"grey\">#{format_date( @todo.completed_at )}</span>" | |
+ elsif @todo.deferred? | |
+ show_date( @todo.show_from ) | |
+ else | |
+ due_date( @todo.due ) | |
+ end | |
+ end | |
+ | |
+ def tag_list_text | |
+ @todo.tags.collect{|t| t.name}.join(', ') | |
+ end | |
+ | |
+ def tag_list | |
+ tags_except_starred = @todo.tags.reject{|t| t.name == Todo::STARRED_TAG_NAME} | |
+ tag_list = tags_except_starred.collect{|t| "<span class=\"tag #{t.name.gsub(' ','-')}\">" + link_to(t.name, :controller => "todos", :action => "tag", :id => t.name) + "</span>"}.join('') | |
+ "<span class='tags'>#{tag_list}</span>" | |
+ end | |
+ | |
+ def tag_list_mobile | |
+ tags_except_starred = @todo.tags.reject{|t| t.name == Todo::STARRED_TAG_NAME} | |
+ # removed the link. TODO: add link to mobile view of tagged actions | |
+ tag_list = tags_except_starred.collect{|t| | |
+ "<span class=\"tag\">" + | |
+ link_to(t.name, {:action => "tag", :controller => "todos", :id => t.name+".m"}) + | |
+ "</span>"}.join('') | |
+ if tag_list.empty? then "" else "<span class=\"tags\">#{tag_list}</span>" end | |
+ end | |
+ | |
+ def deferred_due_date | |
+ if @todo.deferred? && @todo.due | |
+ "(action due on #{format_date(@todo.due)})" | |
+ end | |
+ end | |
+ | |
+ def project_and_context_links(parent_container_type, opts = {}) | |
+ str = '' | |
+ if @todo.completed? | |
+ str += @todo.context.name unless opts[:suppress_context] | |
+ should_suppress_project = opts[:suppress_project] || @todo.project.nil? | |
+ str += ", " unless str.blank? || should_suppress_project | |
+ str += @todo.project.name unless should_suppress_project | |
+ str = "(#{str})" unless str.blank? | |
+ else | |
+ if (['project', 'tag', 'stats', 'search'].include?(parent_container_type)) | |
+ str << item_link_to_context( @todo ) | |
+ end | |
+ if (['context', 'tickler', 'tag', 'stats', 'search'].include?(parent_container_type)) && @todo.project_id | |
+ str << item_link_to_project( @todo ) | |
+ end | |
+ end | |
+ return str | |
+ end | |
+ | |
+ # Uses the 'staleness_starts' value from settings.yml (in days) to colour the | |
+ # background of the action appropriately according to the age of the creation | |
+ # date: | |
+ # * l1: created more than 1 x staleness_starts, but < 2 x staleness_starts | |
+ # * l2: created more than 2 x staleness_starts, but < 3 x staleness_starts | |
+ # * l3: created more than 3 x staleness_starts | |
+ # | |
+ def staleness_class(item) | |
+ if item.due || item.completed? | |
+ return "" | |
+ elsif item.created_at < user_time - (prefs.staleness_starts * 3).days | |
+ return " stale_l3" | |
+ elsif item.created_at < user_time - (prefs.staleness_starts * 2).days | |
+ return " stale_l2" | |
+ elsif item.created_at < user_time - (prefs.staleness_starts).days | |
+ return " stale_l1" | |
+ else | |
+ return "" | |
+ end | |
+ end | |
+ | |
+ # Check show_from date in comparison to today's date Flag up date | |
+ # appropriately with a 'traffic light' colour code | |
+ # | |
+ def show_date(d) | |
+ if d == nil | |
+ return "" | |
+ end | |
+ | |
+ days = days_from_today(d) | |
+ | |
+ case days | |
+ # overdue or due very soon! sound the alarm! | |
+ when -1000..-1 | |
+ "<a title=\"" + format_date(d) + "\"><span class=\"red\">Scheduled to show " + (days * -1).to_s + " days ago</span></a> " | |
+ when 0 | |
+ "<a title=\"" + format_date(d) + "\"><span class=\"amber\">Show Today</span></a> " | |
+ when 1 | |
+ "<a title=\"" + format_date(d) + "\"><span class=\"amber\">Show Tomorrow</span></a> " | |
+ # due 2-7 days away | |
+ when 2..7 | |
+ if prefs.due_style == Preference.due_styles[:due_on] | |
+ "<a title=\"" + format_date(d) + "\"><span class=\"orange\">Show on " + d.strftime("%A") + "</span></a> " | |
+ else | |
+ "<a title=\"" + format_date(d) + "\"><span class=\"orange\">Show in " + days.to_s + " days</span></a> " | |
+ end | |
+ # more than a week away - relax | |
+ else | |
+ "<a title=\"" + format_date(d) + "\"><span class=\"green\">Show in " + days.to_s + " days</span></a> " | |
+ end | |
+ end | |
+ | |
+ def calendar_setup( input_field ) | |
+ str = "Calendar.setup({ ifFormat:\"#{prefs.date_format}\"" | |
+ str << ",firstDay:#{prefs.week_starts},showOthers:true,range:[2004, 2010]" | |
+ str << ",step:1,inputField:\"" + input_field + "\",cache:true,align:\"TR\" })\n" | |
+ javascript_tag str | |
+ end | |
+ | |
+ def item_container_id (todo) | |
+ if source_view_is :project | |
+ return "p#{todo.project_id}" if todo.active? | |
+ return "tickler" if todo.deferred? | |
+ end | |
+ return "c#{todo.context_id}" | |
+ end | |
+ | |
+ def should_show_new_item | |
+ | |
+ if @todo.project.nil? == false | |
+ # do not show new actions that were added to hidden or completed projects | |
+ # on home page and context page | |
+ return false if source_view_is(:todo) && (@todo.project.hidden? || @todo.project.completed?) | |
+ return false if source_view_is(:context) && (@todo.project.hidden? || @todo.project.completed?) | |
+ end | |
+ | |
+ return true if source_view_is(:deferred) && @todo.deferred? | |
+ return true if source_view_is(:project) && @todo.project.hidden? && @todo.project_hidden? | |
+ return true if source_view_is(:project) && @todo.deferred? | |
+ return true if !source_view_is(:deferred) && @todo.active? | |
+ return false | |
+ end | |
+ | |
+ def parent_container_type | |
+ return 'tickler' if source_view_is :deferred | |
+ return 'project' if source_view_is :project | |
+ return 'stats' if source_view_is :stats | |
+ return 'context' | |
+ end | |
+ | |
+ def empty_container_msg_div_id | |
+ return "tickler-empty-nd" if source_view_is_one_of(:project, :tag) && @todo.deferred? | |
+ return "p#{@todo.project_id}empty-nd" if source_view_is :project | |
+ return "c#{@todo.context_id}empty-nd" | |
+ end | |
+ | |
+ def project_names_for_autocomplete | |
+ array_or_string_for_javascript( ['None'] + current_user.projects.active.collect{|p| escape_javascript(p.name) } ) | |
+ end | |
+ | |
+ def context_names_for_autocomplete | |
+ # #return array_or_string_for_javascript(['Create a new context']) if | |
+ # @contexts.empty? | |
+ array_or_string_for_javascript( current_user.contexts.collect{|c| escape_javascript(c.name) } ) | |
+ end | |
+ | |
+ def format_ical_notes(notes) | |
+ split_notes = notes.split(/\n/) | |
+ joined_notes = split_notes.join("\\n") | |
+ end | |
+ | |
+ def formatted_pagination(total) | |
+ s = will_paginate(@todos) | |
+ (s.gsub(/(<\/[^<]+>)/, '\1 ')).chomp(' ') | |
+ end | |
+ | |
+ def date_field_tag(name, id, value = nil, options = {}) | |
+ text_field_tag name, value, {"size" => 12, "id" => id, "class" => "Date", "onfocus" => "Calendar.setup", "autocomplete" => "off"}.update(options.stringify_keys) | |
+ end | |
+ | |
+ private | |
+ | |
+ def image_tag_for_delete | |
+ image_tag("blank.png", :title =>"Delete action", :class=>"delete_item") | |
+ end | |
+ | |
+ def image_tag_for_edit(todo) | |
+ image_tag("blank.png", :title =>"Edit action", :class=>"edit_item", :id=> dom_id(todo, 'edit_icon')) | |
+ end | |
+ | |
+ def image_tag_for_star(todo) | |
+ class_str = todo.starred? ? "starred_todo" : "unstarred_todo" | |
+ image_tag("blank.png", :title =>"Star action", :class => class_str) | |
+ end | |
+ | |
+ def defer_link(days) | |
+ url = {:controller => 'todos', :action => 'defer', :id => @todo.id, :days => days, | |
+ :_source_view => (@source_view.underscore.gsub(/\s+/,'_') rescue "")} | |
+ url[:_tag_name] = @tag_name if @source_view == 'tag' | |
+ | |
+ futuredate = (@todo.show_from || @todo.user.date) + days.days | |
+ if @todo.due && futuredate > @todo.due | |
+ return link_to_function( | |
+ image_tag("defer_#{days}.png", :alt => "Defer #{pluralize(days, 'day')}"), | |
+ "alert('Defer date is after due date. Please edit and adjust due date before deferring.')") | |
+ else | |
+ return link_to_remote( | |
+ image_tag("defer_#{days}.png", :alt => "Defer #{pluralize(days, 'day')}"), | |
+ :url => url) | |
+ end | |
+ end | |
+end | |
Index: app/models/context.rb | |
=================================================================== | |
--- app/models/context.rb (revision 0) | |
+++ app/models/context.rb (working copy) | |
@@ -1,6 +1,7 @@ | |
class Context < ActiveRecord::Base | |
has_many :todos, :dependent => :delete_all, :include => :project, :order => "todos.completed_at DESC" | |
+ has_many :recurring_todos, :dependent => :delete_all | |
belongs_to :user | |
named_scope :active, :conditions => { :hide => false } | |
Index: app/models/preference.rb | |
=================================================================== | |
--- app/models/preference.rb (revision 0) | |
+++ app/models/preference.rb (working copy) | |
@@ -25,7 +25,7 @@ | |
date = nil | |
if s.is_a?(Time) | |
- date = s.to_date | |
+ date = s.in_time_zone(time_zone).to_date | |
elsif s.is_a?(String) | |
date = Date.strptime(s, date_format) | |
else | |
Index: app/models/project.rb | |
=================================================================== | |
--- app/models/project.rb (revision 0) | |
+++ app/models/project.rb (working copy) | |
@@ -1,6 +1,7 @@ | |
class Project < ActiveRecord::Base | |
has_many :todos, :dependent => :delete_all, :include => :context | |
has_many :notes, :dependent => :delete_all, :order => "created_at DESC" | |
+ has_many :recurring_todos | |
belongs_to :default_context, :class_name => "Context", :foreign_key => "default_context_id" | |
belongs_to :user | |
Index: app/models/recurring_todo.rb | |
=================================================================== | |
--- app/models/recurring_todo.rb (revision 0) | |
+++ app/models/recurring_todo.rb (working copy) | |
@@ -596,7 +596,7 @@ | |
unless self.number_of_occurences.nil? | |
return self.occurences_count < self.number_of_occurences | |
else | |
- if self.end_date.nil? | |
+ if self.end_date.nil? || self.ends_on == 'no_end_date' | |
return true | |
else | |
case self.target | |
@@ -631,6 +631,11 @@ | |
end | |
starred? | |
end | |
+ | |
+ def remove_from_project! | |
+ self.project = nil | |
+ self.save | |
+ end | |
def inc_occurences | |
self.occurences_count += 1 | |
Index: app/views/contexts/_mobile_context.rhtml | |
=================================================================== | |
--- app/views/contexts/_mobile_context.rhtml (revision 0) | |
+++ app/views/contexts/_mobile_context.rhtml (working copy) | |
@@ -7,7 +7,6 @@ | |
-%> | |
<h2><%=mobile_context.name%></h2> | |
<ul class="c"> | |
-<table cellpadding="0" cellspacing="0" border="0" class="c"> | |
<%= render :partial => "todos/mobile_todo", | |
:collection => @not_done, | |
:locals => { :parent_container_type => "context" }-%> | |
Index: app/views/contexts/mobile_show_context.rhtml | |
=================================================================== | |
--- app/views/contexts/mobile_show_context.rhtml (revision 0) | |
+++ app/views/contexts/mobile_show_context.rhtml (working copy) | |
@@ -5,10 +5,11 @@ | |
if not @not_done.empty? | |
# only show a context when there are actions in it | |
%> | |
- <h2><%[email protected]%></h2> | |
- <table cellpadding="0" cellspacing="0" border="0"> | |
- <%= render :partial => "todos/mobile_todo", | |
- :collection => @not_done, | |
- :locals => { :parent_container_type => "context" }%> | |
- </table> | |
-<% end -%> | |
\ No newline at end of file | |
+<h2><%[email protected]%></h2> | |
+<ul class="c"> | |
+<table cellpadding="0" cellspacing="0" border="0" class="c"> | |
+<%= render :partial => "todos/mobile_todo", | |
+ :collection => @not_done, | |
+ :locals => { :parent_container_type => "context" }-%> | |
+</ul> | |
+<% end -%> | |
Index: app/views/notes/_notes.rhtml | |
=================================================================== | |
--- app/views/notes/_notes.rhtml (revision 0) | |
+++ app/views/notes/_notes.rhtml (working copy) | |
@@ -1,7 +1,7 @@ | |
<% note = notes -%> | |
<div id="<%= dom_id(note, 'container') %>"> | |
<h2><%= link_to("Note #{note.id}", note_path(note), :title => "Show note #{note.id}" ) %></h2> | |
- <div id="<%= dom_id(note) %>"> | |
+ <div class="project_notes" id="<%= dom_id(note) %>"> | |
<%= sanitize(markdown(auto_link(note.body))) %> | |
<div class="note_footer"> | |
Index: app/views/projects/show.html.erb | |
=================================================================== | |
--- app/views/projects/show.html.erb (revision 0) | |
+++ app/views/projects/show.html.erb (working copy) | |
@@ -4,7 +4,7 @@ | |
</div> | |
<%= render :partial => "projects/project", :locals => { :project => @project, :collapsible => false } %> | |
-<%= render :partial => "todos/deferred", :locals => { :deferred => @deferred, :collapsible => false, :append_descriptor => "in this project" } %> | |
+<%= render :partial => "todos/deferred", :locals => { :deferred => @deferred, :collapsible => false, :append_descriptor => "in this project", :parent_container_type => 'project' } %> | |
<% unless @max_completed==0 -%> | |
<%= render :partial => "todos/completed", :locals => { :done => @done, :collapsible => false, :suppress_project => true, :append_descriptor => "in this project" } %> | |
<% end -%> | |
Index: app/views/recurring_todos/_recurring_todo_form.erb | |
=================================================================== | |
--- app/views/recurring_todos/_recurring_todo_form.erb (revision 236) | |
+++ app/views/recurring_todos/_recurring_todo_form.erb (working copy) | |
@@ -73,12 +73,12 @@ | |
<div id="recurring_timespan"> | |
<br/> | |
<label for="recurring_todo[start_from]">Starts on </label><%= | |
- text_field(:recurring_todo, :start_from, "value" => format_date(Time.today), "size" => 12, "class" => "Date", "onfocus" => "Calendar.setup", "tabindex" => 6, "autocomplete" => "off") %><br/> | |
+ text_field(:recurring_todo, :start_from, "value" => format_date(user_time), "size" => 12, "class" => "Date", "onfocus" => "Calendar.setup", "tabindex" => 6, "autocomplete" => "off") %><br/> | |
<br/> | |
<label for="recurring_todo[ends_on]">Ends on:</label><br/> | |
<%= radio_button_tag('recurring_todo[ends_on]', 'no_end_date', true)%> No end date<br/> | |
<%= radio_button_tag('recurring_todo[ends_on]', 'ends_on_number_of_times')%> Ends after <%= text_field( :recurring_todo, :number_of_occurences, "size" => 3, "tabindex" => 7) %> times<br/> | |
- <%= radio_button_tag('recurring_todo[ends_on]', 'ends_on_end_date')%> Ends on <%= text_field(:recurring_todo, :end_date, "size" => 12, "class" => "Date", "onfocus" => "Calendar.setup", "tabindex" => 8, "autocomplete" => "off") %><br/> | |
+ <%= radio_button_tag('recurring_todo[ends_on]', 'ends_on_end_date')%> Ends on <%= text_field(:recurring_todo, :end_date, "size" => 12, "class" => "Date", "onfocus" => "Calendar.setup", "tabindex" => 8, "autocomplete" => "off", "value" => "") %><br/> | |
</div></div> | |
<div id="recurring_daily" style="display:block"> | |
<label>Settings for daily recurring actions</label><br/> | |
Index: app/views/shared/_add_new_item_form.rhtml | |
=================================================================== | |
--- app/views/shared/_add_new_item_form.rhtml (revision 0) | |
+++ app/views/shared/_add_new_item_form.rhtml (working copy) | |
@@ -43,7 +43,7 @@ | |
<div id="status"><%= error_messages_for("item", :object_name => 'action') %></div> | |
<label for="todo_description">Description</label> | |
-<%= text_field( "todo", "description", "size" => 30, "tabindex" => 1, "maxlength" => 100) %> | |
+<%= text_field( "todo", "description", "size" => 30, "tabindex" => 1, "maxlength" => 100, "autocomplete" => "off") %> | |
<label for="todo_notes">Notes</label> | |
<%= text_area( "todo", "notes", "cols" => 29, "rows" => 6, "tabindex" => 2) %> | |
@@ -110,7 +110,8 @@ | |
<%= text_field("todo", "show_from", "size" => 12, "class" => "Date", "onfocus" => "Calendar.setup", "tabindex" => 7, "autocomplete" => "off") %> | |
</div> | |
-<%= source_view_tag( @source_view ) %> | |
+<%= source_view_tag( @source_view ) %> | |
+<%= hidden_field_tag :_tag_name, @tag_name.underscore.gsub(/\s+/,'_') if source_view_is :tag %> | |
<div class="submit_box"> | |
<div class="widgets"> | |
Index: app/views/shared/_footer.rhtml | |
=================================================================== | |
--- app/views/shared/_footer.rhtml (revision 0) | |
+++ app/views/shared/_footer.rhtml (working copy) | |
@@ -1,3 +1,3 @@ | |
<div id="footer"> | |
- <p>Send feedback on <%= TRACKS_VERSION %>: <a href="http://www.assembla.com/spaces/tracks-tickets/tickets">Bugs</a> | <a href="http://www.getontracks.org/forums/">Forum</a> | <a href="http://www.getontracks.org/wiki/">Wiki</a> | <a href="mailto:[email protected]?subject=Tracks feedback">Email</a> | <a href="http://www.getontracks.org/">Website</a> | <a href="http://www.getontracks.org/development/">Contribute</a></p> | |
+ <p>Send feedback on <%= TRACKS_VERSION %>: <a href="http://www.assembla.com/spaces/tracks-tickets/tickets">Bugs</a> | <a href="http://www.getontracks.org/forums/">Forum</a> | <a href="http://www.getontracks.org/wiki/">Wiki</a> | <a href="mailto:[email protected]?subject=Tracks feedback">Email</a> | <a href="http://www.getontracks.org/">Website</a> | <a href="http://getontracks.org/tracks/contribute">Contribute</a></p> | |
</div> | |
Index: app/views/shared/_mobile_footer.rhtml | |
=================================================================== | |
--- app/views/shared/_mobile_footer.rhtml (revision 0) | |
+++ app/views/shared/_mobile_footer.rhtml (working copy) | |
@@ -1 +1 @@ | |
-<div class="footer"><p>Mobile Tracks <%= TRACKS_VERSION %>: <a href="mailto:[email protected]?subject=Tracks feedback">Email</a> | <a href="http://www.rousette.org.uk/projects/">Website</a> | <a href="http://www.rousette.org.uk/projects/tracks/contribute">Contribute</a></p></div> | |
\ No newline at end of file | |
+<div class="footer"><p>Mobile Tracks <%= TRACKS_VERSION %>: <a href="mailto:[email protected]?subject=Tracks feedback">Email</a> | <a href="http://www.getontracks.org/">Website</a> | <a href="http://getontracks.org/tracks/contribute">Contribute</a></p></div> | |
\ No newline at end of file | |
Index: app/views/stats/actions_done_last12months_data.html.erb | |
=================================================================== | |
--- app/views/stats/actions_done_last12months_data.html.erb (revision 0) | |
+++ app/views/stats/actions_done_last12months_data.html.erb (working copy) | |
@@ -14,8 +14,8 @@ | |
&links=<% 0.upto 11 do |i| -%><%= url_for :controller => 'stats', :action => 'actions_done_last_years' %>,<% end -%><%= url_for :controller => 'stats', :action => 'actions_done_last_years' %>& | |
&links_2=<% 0.upto 11 do |i| -%><%= url_for :controller => 'stats', :action => 'actions_done_last_years' %>,<% end -%><%= url_for :controller => 'stats', :action => 'actions_done_last_years' %>& | |
&values_2=<% 0.upto 11 do |i| -%><%= @actions_done_last12months_hash[i]%>,<% end -%><%= @actions_done_last12months_hash[12]%>& | |
-&values_3=<%0.upto 11 do |i| -%><%=@sum_actions_created_last12months/12-%>,<%end-%><%=@sum_actions_created_last12months/12-%>& | |
-&values_4=<%0.upto 11 do |i| -%><%=@sum_actions_done_last12months/12-%>,<%end-%><%=@sum_actions_done_last12months/12-%>& | |
+&values_3=<%0.upto 11 do |i| -%><%=@sum_actions_created_last12months/12.0-%>,<%end-%><%=@sum_actions_created_last12months/12.0-%>& | |
+&values_4=<%0.upto 11 do |i| -%><%=@sum_actions_done_last12months/12.0-%>,<%end-%><%=@sum_actions_done_last12months/12.0-%>& | |
&values_5=<%0.upto 11 do |i| -%><%=@actions_created_avg_last12months_hash[i]-%>,<%end-%><%=@actions_created_avg_last12months_hash[12]-%>& | |
&values_6=<%0.upto 11 do |i| -%><%=@actions_done_avg_last12months_hash[i]-%>,<%end-%><%=@actions_done_avg_last12months_hash[12]-%>& | |
&values_7=<%=@interpolated_actions_created_this_month%>,<%=@actions_done_avg_last12months_hash[1]%>& | |
Index: app/views/stats/actions_done_last30days_data.html.erb | |
=================================================================== | |
--- app/views/stats/actions_done_last30days_data.html.erb (revision 0) | |
+++ app/views/stats/actions_done_last30days_data.html.erb (working copy) | |
@@ -16,14 +16,14 @@ | |
<% end -%><%= @actions_done_last30days_hash[30]%>& | |
&values_3= | |
<%0.upto 29 do |i| -%> | |
-<%=@sum_actions_created_last30days/30-%>, | |
+<%=@sum_actions_created_last30days/30.0-%>, | |
<%end-%> | |
-<%=@sum_actions_created_last30days/30-%>& | |
+<%=@sum_actions_created_last30days/30.0-%>& | |
&values_4= | |
<%0.upto 29 do |i| -%> | |
-<%=@sum_actions_done_last30days/30-%>, | |
+<%=@sum_actions_done_last30days/30.0-%>, | |
<%end-%> | |
-<%=@sum_actions_done_last30days/30-%>& | |
+<%=@sum_actions_done_last30days/30.0-%>& | |
&x_labels= | |
<%0.upto 29 do |i| | |
seconds = i * 24 * 60 * 60 | |
Index: app/views/stats/context_running_actions_data.html.erb | |
=================================================================== | |
--- app/views/stats/context_running_actions_data.html.erb (revision 0) | |
+++ app/views/stats/context_running_actions_data.html.erb (working copy) | |
@@ -10,7 +10,7 @@ | |
0.upto @actions_per_context.size()-2 do | i | | |
%><%=truncate(@actions_per_context[i]['name'], :length => @truncate_chars, :omission => '...')%>,<% | |
end | |
--%><%=truncate(@actions_per_context[@actions_per_context.size()-1]['name'], :legnth => @truncate_chars, :omission => '...') %>& | |
+-%><%=truncate(@actions_per_context[@actions_per_context.size()-1]['name'], :length => @truncate_chars, :omission => '...') %>& | |
&links=<% | |
0.upto @actions_per_context.size()-2 do | i | | |
%><%=url_for :controller => "contexts", :action => "show", :id=>@actions_per_context[i]['id']%>,<% | |
Index: app/views/todos/_deferred.rhtml | |
=================================================================== | |
--- app/views/todos/_deferred.rhtml (revision 0) | |
+++ app/views/todos/_deferred.rhtml (working copy) | |
@@ -11,7 +11,7 @@ | |
<div class="message"><p>Currently there are no deferred actions</p></div> | |
</div> | |
- <%= render :partial => "todos/todo", :collection => deferred, :locals => { :parent_container_type => 'tickler' } %> | |
+ <%= render :partial => "todos/todo", :collection => deferred, :locals => { :parent_container_type => parent_container_type } %> | |
</div><!-- [end:items] --> | |
</div><!-- [end:tickler] --> | |
\ No newline at end of file | |
Index: app/views/todos/calendar.html.erb | |
=================================================================== | |
--- app/views/todos/calendar.html.erb (revision 0) | |
+++ app/views/todos/calendar.html.erb (working copy) | |
@@ -1,5 +1,5 @@ | |
<div id="display_box"> | |
- | |
+ | |
<div class="container"> | |
<h2>Due today</h2> | |
<div id="empty_due_today" <%= "style=\"display:none\"" unless @due_today.empty? %>> | |
@@ -9,7 +9,7 @@ | |
<%= render :partial => "todos/todo", :collection => @due_today %> | |
</div> | |
</div> | |
- | |
+ | |
<div class="container"> | |
<h2>Due in rest of this week</h2> | |
<div id="empty_due_this_week" <%= "style=\"display:none\"" unless @due_this_week.empty? %>> | |
@@ -19,7 +19,7 @@ | |
<%= render :partial => "todos/todo", :collection => @due_this_week %> | |
</div> | |
</div> | |
- | |
+ | |
<div class="container"> | |
<h2>Due next week</h2> | |
<div id="empty_due_next_week" <%= "style=\"display:none\"" unless @due_next_week.empty? %>> | |
@@ -29,7 +29,7 @@ | |
<%= render :partial => "todos/todo", :collection => @due_next_week %> | |
</div> | |
</div> | |
- | |
+ | |
<div class="container"> | |
<h2>Due in rest of <%= Time.zone.now.strftime("%B") %> </h2> | |
<div id="empty_due_this_month" <%= "style=\"display:none\"" unless @due_this_month.empty? %>> | |
@@ -39,7 +39,7 @@ | |
<%= render :partial => "todos/todo", :collection => @due_this_month %> | |
</div> | |
</div> | |
- | |
+ | |
<div class="container"> | |
<h2>Due in <%= (Time.zone.now+1.month).strftime("%B") %> and later</h2> | |
<div id="empty_due_after_this_month" <%= "style=\"display:none\"" unless @due_after_this_month.empty? %>> | |
@@ -49,9 +49,14 @@ | |
<%= render :partial => "todos/todo", :collection => @due_after_this_month %> | |
</div> | |
</div> | |
- | |
+ | |
</div><!-- End of display_box --> | |
<div class="input_box" id="input_box"> | |
+ <% # hack for #860 Need to refactor this and use another dom element to bind projectDefauiltContextsMap to -%> | |
+ <input type="hidden" id="todo_context_name" value="hidden"> | |
+ <script type="text/javascript"> | |
+ $('todo_context_name').projectDefaultContextsMap = eval('(' + <%= @default_project_context_name_map %> + ')'); | |
+ </script> | |
<!-- | |
<input class="hide_tickler" id="hide_tickler" type="checkbox" tabindex="5" name="hide_tickler" checked="true"/> | |
<label for="hide_tickler"> Show actions in tickler</label> | |
Index: app/views/todos/calendar.ics.erb | |
=================================================================== | |
--- app/views/todos/calendar.ics.erb (revision 0) | |
+++ app/views/todos/calendar.ics.erb (working copy) | |
@@ -11,6 +11,7 @@ | |
due_date = Time.zone.now | |
overdue_text = "Overdue: " | |
end | |
+ modified = todo.updated_at || todo.created_at | |
%>BEGIN:VEVENT | |
DTSTART;VALUE=DATE:<%= due_date.strftime("%Y%m%d") %> | |
DTEND;VALUE=DATE:<%= (due_date+1.day).strftime("%Y%m%d") %> | |
@@ -20,7 +21,7 @@ | |
CATEGORIES:Tracks | |
CREATED:<%= todo.created_at.strftime("%Y%m%dT%H%M%SZ") %> | |
DESCRIPTION:<%= format_ical_notes(todo.notes) %> | |
-LAST-MODIFIED:<%= todo.updated_at.strftime("%Y%m%dT%H%M%SZ") %> | |
+LAST-MODIFIED:<%= modified.strftime("%Y%m%dT%H%M%SZ") %> | |
LOCATION: | |
SEQUENCE:0 | |
STATUS:CONFIRMED | |
Index: app/views/todos/create.js.rjs | |
=================================================================== | |
--- app/views/todos/create.js.rjs (revision 0) | |
+++ app/views/todos/create.js.rjs (working copy) | |
@@ -16,7 +16,7 @@ | |
page.insert_html :top, 'display_box', :partial => 'contexts/context', :locals => { :context => @todo.context, :collapsible => true } | |
else | |
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@todo.context_id}" if source_view_is_one_of(:todo, :deferred) | |
- page.insert_html :bottom, item_container_id(@todo) + 'items', :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type, :source_view => @source_view } | |
+ page.insert_html :bottom, item_container_id(@todo), :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type, :source_view => @source_view } | |
page.visual_effect :highlight, dom_id(@todo), :duration => 3 | |
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil? | |
end | |
Index: app/views/todos/destroy.js.rjs | |
=================================================================== | |
--- app/views/todos/destroy.js.rjs (revision 0) | |
+++ app/views/todos/destroy.js.rjs (working copy) | |
@@ -11,14 +11,18 @@ | |
page['tickler-empty-nd'].show if source_view_is(:deferred) && @down_count == 0 | |
# show new todo if the completed todo was recurring | |
- unless @new_recurring_todo.nil? | |
- page.call "todoItems.ensureVisibleWithEffectAppear", item_container_id(@new_recurring_todo) | |
- page.insert_html :bottom, item_container_id(@new_recurring_todo), :partial => 'todos/todo', :locals => { :todo => @new_recurring_todo, :parent_container_type => parent_container_type } | |
- page.visual_effect :highlight, dom_id(@new_recurring_todo, 'line'), {'startcolor' => "'#99ff99'"} | |
- page.notify :notice, "Action was deleted. Because this action is recurring, a new action was added", 6.0 | |
- else | |
- page.notify :notice, "There is no next action after the recurring action you just deleted. The recurrence is completed", 6.0 unless @recurring_todo.nil? | |
+ if @todo.from_recurring_todo? | |
+ unless @new_recurring_todo.nil? || @new_recurring_todo.deferred? | |
+ page.call "todoItems.ensureVisibleWithEffectAppear", item_container_id(@new_recurring_todo) | |
+ page.insert_html :bottom, item_container_id(@new_recurring_todo), :partial => 'todos/todo', :locals => { :todo => @new_recurring_todo, :parent_container_type => parent_container_type } | |
+ page.visual_effect :highlight, dom_id(@new_recurring_todo, 'line'), {'startcolor' => "'#99ff99'"} | |
+ page.notify :notice, "Action was deleted. Because this action is recurring, a new action was added", 6.0 | |
+ else | |
+ if @todo.recurring_todo.todos.active.count == 0 | |
+ page.notify :notice, "There is no next action after the recurring action you just deleted. The recurrence is completed", 6.0 if @new_recurring_todo.nil? | |
+ end | |
+ end | |
end | |
else | |
page.notify :error, "There was an error deleting the item #{@todo.description}", 8.0 | |
-end | |
\ No newline at end of file | |
+end | |
Index: app/views/todos/tag.html.erb | |
=================================================================== | |
--- app/views/todos/tag.html.erb (revision 0) | |
+++ app/views/todos/tag.html.erb (working copy) | |
@@ -8,7 +8,7 @@ | |
:locals => { :collapsible => true } %> | |
<% unless @deferred.nil? -%> | |
- <%= render :partial => "todos/deferred", :locals => { :deferred => @deferred, :collapsible => true, :append_descriptor => "tagged with ‘#{@tag_name}’" } %> | |
+ <%= render :partial => "todos/deferred", :locals => { :deferred => @deferred, :collapsible => true, :append_descriptor => "tagged with ‘#{@tag_name}’", :parent_container_type => 'tag' } %> | |
<% end -%> | |
<% unless @hidden_todos.nil? -%> | |
Index: app/views/todos/toggle_check.js.rjs | |
=================================================================== | |
--- app/views/todos/toggle_check.js.rjs (revision 0) | |
+++ app/views/todos/toggle_check.js.rjs (working copy) | |
@@ -16,7 +16,13 @@ | |
if @remaining_in_context == 0 && source_view_is(:todo) | |
page.visual_effect :fade, item_container_id(@todo), :duration => 0.4 | |
end | |
- | |
+ | |
+ if @original_item_was_deferred && source_view_is(:tag) | |
+ # we go from the deferred container to the completed container in tag view | |
+ # check for empty message | |
+ page['tickler-empty-nd'].show if @deferred_tag_count == 0 | |
+ end | |
+ | |
# show new todo if the completed todo was recurring | |
if @todo.from_recurring_todo? | |
unless @new_recurring_todo.nil? || @new_recurring_todo.deferred? | |
Index: app/views/todos/update.js.rjs | |
=================================================================== | |
--- app/views/todos/update.js.rjs (revision 0) | |
+++ app/views/todos/update.js.rjs (working copy) | |
@@ -6,9 +6,12 @@ | |
status_message = 'Added new context / ' + status_message if @new_context_created | |
page.notify :notice, status_message, 5.0 | |
- # update auto completer arrays for context and project | |
- page << "contextAutoCompleter.options.array = #{context_names_for_autocomplete}; contextAutoCompleter.changed = true" if @new_context_created | |
- page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}; projectAutoCompleter.changed = true" if @new_project_created | |
+ # update auto completer arrays for edit form in right column, only for pages | |
+ # with that form | |
+ unless source_view_is_one_of(:calendar) | |
+ page << "contextAutoCompleter.options.array = #{context_names_for_autocomplete}; contextAutoCompleter.changed = true" if @new_context_created | |
+ page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}; projectAutoCompleter.changed = true" if @new_project_created | |
+ end | |
if source_view_is_one_of(:todo, :context, :tag) | |
if @context_changed || @todo.deferred? | |
@@ -30,7 +33,7 @@ | |
end | |
end | |
end | |
- | |
+ | |
if source_view_is_one_of(:todo, :tag) && @todo.active? | |
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@todo.context_id}" | |
page.call "todoItems.expandNextActionListingByContext", "c#{@todo.context_id}items", true | |
@@ -38,6 +41,12 @@ | |
# show all todos in context | |
page.insert_html :bottom, "c#{@todo.context_id}items", :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type } | |
end | |
+ | |
+ if source_view_is(:tag) && @todo.deferred? | |
+ # show todo in deferred container | |
+ page.insert_html :bottom, "tickleritems", :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type } | |
+ page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil? | |
+ end | |
# update badge count | |
page.replace_html("badge_count", @remaining_in_context) if source_view_is :context | |
@@ -52,9 +61,20 @@ | |
end | |
end | |
else | |
- page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type } | |
+ if @original_item_was_deferred && source_view_is(:tag) | |
+ # we go from the deferred container to a context container in tag view | |
+ page[@todo].remove | |
+ page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@todo.context_id}" | |
+ page.call "todoItems.expandNextActionListingByContext", "c#{@todo.context_id}items", true | |
+ page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil? | |
+ # show all todos in context | |
+ page.insert_html :bottom, "c#{@todo.context_id}items", :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type } | |
+ page['tickler-empty-nd'].show if @deferred_tag_count == 0 | |
+ else | |
+ page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type } | |
+ end | |
page.visual_effect :highlight, dom_id(@todo), :duration => 3 | |
- end | |
+ end | |
elsif source_view_is :project | |
if @project_changed | |
page[@todo].remove | |
Index: app/views/users/index.html.erb | |
=================================================================== | |
--- app/views/users/index.html.erb (revision 0) | |
+++ app/views/users/index.html.erb (working copy) | |
@@ -2,34 +2,38 @@ | |
<p>You have a total of <span id="user_count"><%= @total_users %></span> users</p> | |
- <table class="users_table"> | |
+<table class="users_table"> | |
<tr> | |
- <th>Login</th> | |
- <th>Full name</th> | |
- <th>Authorization type</th> | |
- <th>Open ID URL</th> | |
- <th>Total actions</th> | |
- <th>Total contexts</th> | |
- <th>Total projects</th> | |
- <th>Total notes</th> | |
- <th> </th> | |
+ <th>Login</th> | |
+ <th>Full name</th> | |
+ <th>Authorization type</th> | |
+ <th>Open ID URL</th> | |
+ <th>Total actions</th> | |
+ <th>Total contexts</th> | |
+ <th>Total projects</th> | |
+ <th>Total notes</th> | |
+ <th> </th> | |
</tr> | |
<% for user in @users %> | |
- <tr <%= "class=\"highlight\"" if user.is_admin? %> id="user-<%= user.id %>"> | |
- <td><%=h user.login %></td> | |
- <td><%=h user.last_name? ? user.display_name : '-' %></td> | |
- <td><%= h user.auth_type %></td> | |
- <td><%= h user.open_id_url || '-' %></td> | |
- <td><%= h user.todos.size %></td> | |
- <td><%= h user.contexts.size %></td> | |
- <td><%= h user.projects.size %></td> | |
- <td><%= h user.notes.size %></td> | |
- <td><%= !user.is_admin? ? link_to_remote( image_tag("blank.png", :title =>"Destroy user", :class=>"delete_item"), {:url => user_path(user), :method => :delete, :confirm => "Warning: this will delete user \'#{user.login}\', all their actions, contexts, project and notes. Are you sure that you want to continue?" }, { :class => "icon" } ) : " " %></td> | |
- </tr> | |
- <% end %> | |
- </table> | |
- <p> | |
- <%= will_paginate @users %> | |
- </p> | |
- | |
- <p><%= link_to 'Signup new user', signup_path %></p> | |
\ No newline at end of file | |
+ <tr <%= "class=\"highlight\"" if user.is_admin? %> id="user-<%= user.id %>"> | |
+ <td><%=h user.login %></td> | |
+ <td><%=h user.last_name? ? user.display_name : '-' %></td> | |
+ <td><%= h user.auth_type %></td> | |
+ <td><%= h user.open_id_url || '-' %></td> | |
+ <td><%= h user.todos.size %></td> | |
+ <td><%= h user.contexts.size %></td> | |
+ <td><%= h user.projects.size %></td> | |
+ <td><%= h user.notes.size %></td> | |
+ <td><%= !user.is_admin? ? link_to_remote( | |
+ image_tag("blank.png", :title =>"Destroy user", :class=>"delete_item"), | |
+ { :url => user_path(user.id), :method => :delete, | |
+ :confirm => "Warning: this will delete user \'#{user.login}\', all their actions, contexts, project and notes. Are you sure that you want to continue?" }, | |
+ { :class => "icon" } ) : " " %></td> | |
+ </tr> | |
+ <% end %> | |
+</table> | |
+<p> | |
+ <%= will_paginate @users %> | |
+</p> | |
+ | |
+<p><%= link_to 'Signup new user', signup_path %></p> | |
\ No newline at end of file | |
Index: config/environment.rb | |
=================================================================== | |
--- config/environment.rb (revision 0) | |
+++ config/environment.rb (working copy) | |
@@ -54,6 +54,11 @@ | |
# (enables use of different database adapters for development and test environments) | |
config.active_record.schema_format = :ruby | |
+ # allow other protocols in urls for sanitzer. Add to your liking, for example | |
+ # config.action_view.sanitized_allowed_protocols = 'onenote', 'blah', 'proto' | |
+ # to enable "link":onenote://... or "link":blah://... hyperlinks | |
+ config.action_view.sanitized_allowed_protocols = 'onenote' | |
+ | |
# See Rails::Configuration for more options | |
end | |
@@ -85,8 +90,10 @@ | |
SimpleLdapAuthenticator.use_ssl = ldap['ssl'] | |
SimpleLdapAuthenticator.login_format = ldap['login_format'] | |
end | |
+ | |
if ( SITE_CONFIG['authentication_schemes'].include? 'open_id') | |
#requires ruby-openid gem to be installed | |
+ OpenID::Util.logger = RAILS_DEFAULT_LOGGER | |
end | |
- | |
-TRACKS_VERSION='1.7' | |
+ | |
+TRACKS_VERSION='1.7.1' | |
Index: doc/CHANGELOG | |
=================================================================== | |
--- doc/CHANGELOG (revision 0) | |
+++ doc/CHANGELOG (working copy) | |
@@ -8,10 +8,28 @@ | |
* Mailing list: http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss | |
* Original developer: bsag (http://www.rousette.org.uk/) | |
* Contributors: http://getontracks.org/wiki/Tracks/Contributing/Contributors | |
-* Version: 1.7 | |
-* Copyright: (cc) 2004-2009 rousette.org.uk. | |
+* Version: 1.7.1 | |
+* Copyright: (cc) 2004-2010 rousette.org.uk. | |
* License: GNU GPL | |
+== Version 1.7.1 | |
+ | |
+This is a bugfix release. New feature development is done on the 2.0 development tree. | |
+ | |
+New features in 1.7.1: | |
+1. you can now add a new todo from the calendar view | |
+2. user naems can now contain dots (.) | |
+3. support onenote urls (hyperlinks to Microsoft OneNote elements) | |
+ | |
+Under the hood: | |
+1. Several fixes for timezone support | |
+2. Export to xml works again | |
+3. Make sure tracks works on current rubygems | |
+4. notes are styled better | |
+5. Recurring todo fixes | |
+ | |
+And lots of other fixes.... | |
+ | |
== Version 1.7 | |
New features: | |
Index: public/stylesheets/standard.css | |
=================================================================== | |
--- public/stylesheets/standard.css (revision 0) | |
+++ public/stylesheets/standard.css (working copy) | |
@@ -13,10 +13,7 @@ | |
fieldset,img { | |
border:0; | |
} | |
-address,caption,cite,code,dfn,em,strong,th,var { | |
- font-style:normal; | |
- font-weight:normal; | |
-} | |
+ | |
ol,ul { | |
list-style:none; | |
} | |
@@ -401,28 +398,48 @@ | |
/* The notes which may be attached to an item */ | |
.todo_notes { | |
margin: 5px; | |
- padding: 3px; | |
+ padding: 5px; | |
border: 1px solid #F5ED59; | |
background: #FAF6AE; | |
color: #666666; | |
} | |
-.todo_notes p, .todo_notes li { | |
- padding: 1px; | |
- margin: 0px; | |
- font-size: 12px; | |
+.todo_notes p, .todo_notes ul, .todo_notes ol, | |
+.project_notes p, .project_notes ul, .project_notes ol { | |
+ margin: 10px 0px; | |
+ font-size: 1em; | |
} | |
-.todo_notes ul, .note_wrapper ul { | |
+.todo_notes ul, .note_wrapper ul, | |
+.project_notes ul, .project_notes ul { | |
list-style-type: disc; | |
- margin-left:20px; | |
+ margin-left: 15px; | |
} | |
-.todo_notes ol { | |
+.todo_notes ol, .project_notes ol { | |
list-style-type: decimal; | |
- margin-left:20px; | |
+ margin-left: 15px; | |
} | |
+.todo_notes ol li, .todo_notes ul li, | |
+.project_notes ol li, .project_notes ul li { | |
+ margin-left: 20px; | |
+} | |
+ | |
+.todo_notes h1, .project_notes h1 { | |
+ font-size: 1.5em; | |
+ font-weight: bold; | |
+ margin: 10px 0px; | |
+} | |
+ | |
+.todo_notes h2, .project_notes h2 { | |
+ font-size: 1.2em; | |
+ font-style: italic; | |
+ margin: 10px 0px !important; | |
+ padding: 0px !important; | |
+ background-color: transparent !important; | |
+} | |
+ | |
/* The notes for the project */ | |
div.note_wrapper { | |
@@ -449,6 +466,11 @@ | |
background-color: transparent; | |
} | |
+/* For the detailed notes view */ | |
+.project_notes { | |
+ padding: 5px; | |
+} | |
+ | |
div.add_note_link { | |
margin-top:12px; | |
float: right; | |
Index: README | |
=================================================================== | |
--- README (revision 0) | |
+++ README (working copy) | |
@@ -8,8 +8,8 @@ | |
* Mailing list: http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss | |
* Original developer: bsag (http://www.rousette.org.uk/) | |
* Contributors: http://getontracks.org/wiki/Tracks/Contributing/Contributors | |
-* Version: 1.7 | |
-* Copyright: (cc) 2004-2009 rousette.org.uk. | |
+* Version: 1.7.1 | |
+* Copyright: (cc) 2004-2010 rousette.org.uk. | |
* License: GNU GPL | |
All the documentation for Tracks can be found within the /doc directory. It contains a manual in HTML (manual.html) or PDF format (manual.pdf), and this includes full instructions for both new installations and upgrades from older installations of Tracks. The instructions might appear long and intimidatingly complex, but that is mostly because of the number of different platforms supported, and the different configurations which can be used (e.g. running Tracks on your local computer or on a remote server). If you choose the appropriate section for your situation (installation vs. upgrade), and use the easiest (recommended) method, you should find the instructions easy to follow. If you encounter problems, try searching the wiki, forum or mailing list (URLs above), and ask a question if you cannot find a solution to your problem. | |
Index: spec/models/user_spec.rb | |
=================================================================== | |
--- spec/models/user_spec.rb (revision 0) | |
+++ spec/models/user_spec.rb (working copy) | |
@@ -57,7 +57,7 @@ | |
it 'has many completed todos' do | |
User.should have_many(:completed_todos). | |
with_order('todos.completed_at DESC'). | |
- with_conditions('todos.state = ? and todos.completed_at is not null', 'completed'). | |
+ with_conditions('todos.state = ? AND NOT(todos.completed_at IS NULL)', 'completed'). | |
with_include(:project, :context). | |
with_class_name('Todo') | |
end | |
Index: test/fixtures/recurring_todos.yml | |
=================================================================== | |
--- test/fixtures/recurring_todos.yml (revision 0) | |
+++ test/fixtures/recurring_todos.yml (working copy) | |
@@ -22,7 +22,7 @@ | |
%> | |
-1: | |
+call_bill_gates_every_day: | |
id: 1 | |
user_id: 1 | |
context_id: 1 | |
@@ -48,7 +48,7 @@ | |
created_at: <%= last_week %> | |
completed_at: ~ | |
-2: | |
+call_bill_gates_every_workday: | |
id: 2 | |
user_id: 1 | |
context_id: 1 | |
@@ -74,7 +74,7 @@ | |
created_at: <%= last_week %> | |
completed_at: ~ | |
-3: | |
+call_bill_gates_every_week: | |
id: 3 | |
user_id: 1 | |
context_id: 1 | |
@@ -100,7 +100,7 @@ | |
created_at: <%= last_week %> | |
completed_at: ~ | |
-4: | |
+check_with_bill_every_last_friday_of_month: | |
id: 4 | |
user_id: 1 | |
context_id: 1 | |
@@ -126,7 +126,7 @@ | |
created_at: <%= last_week %> | |
completed_at: ~ | |
-5: | |
+birthday_reinier: | |
id: 5 | |
user_id: 1 | |
context_id: 1 | |
@@ -150,4 +150,4 @@ | |
every_count: ~ | |
weekday: ~ | |
created_at: <%= last_week %> | |
- completed_at: ~ | |
\ No newline at end of file | |
+ completed_at: ~ | |
Index: test/fixtures/todos.yml | |
=================================================================== | |
--- test/fixtures/todos.yml (revision 0) | |
+++ test/fixtures/todos.yml (working copy) | |
@@ -23,7 +23,7 @@ | |
%> | |
-1: | |
+call_bill: | |
id: 1 | |
context_id: 1 | |
project_id: 2 | |
@@ -35,7 +35,7 @@ | |
completed_at: ~ | |
user_id: 1 | |
-2: | |
+call_dino_ext: | |
id: 2 | |
context_id: 2 | |
project_id: 3 | |
@@ -47,7 +47,7 @@ | |
completed_at: ~ | |
user_id: 1 | |
-3: | |
+buy_milk: | |
id: 3 | |
context_id: 4 | |
project_id: ~ | |
@@ -59,7 +59,7 @@ | |
completed_at: <%= today %> | |
user_id: 1 | |
-4: | |
+buy_bread: | |
id: 4 | |
context_id: 4 | |
project_id: ~ | |
@@ -71,7 +71,7 @@ | |
completed_at: <%= today %> | |
user_id: 1 | |
-5: | |
+construct_dilation_device: | |
id: 5 | |
context_id: 5 | |
project_id: 1 | |
@@ -83,7 +83,7 @@ | |
completed_at: ~ | |
user_id: 1 | |
-6: | |
+phone_grandfather: | |
id: 6 | |
context_id: 2 | |
project_id: 1 | |
@@ -107,7 +107,7 @@ | |
completed_at: ~ | |
user_id: 1 | |
-8: | |
+upgrade_rails: | |
id: 8 | |
context_id: 4 | |
project_id: ~ | |
@@ -119,7 +119,7 @@ | |
completed_at: <%= today %> | |
user_id: 1 | |
-9: | |
+due_today: | |
id: 9 | |
context_id: 1 | |
project_id: ~ | |
@@ -131,7 +131,7 @@ | |
completed_at: ~ | |
user_id: 1 | |
-10: | |
+foo: | |
id: 10 | |
context_id: 1 | |
project_id: ~ | |
@@ -143,7 +143,7 @@ | |
completed_at: <%= last_week %> | |
user_id: 1 | |
-11: | |
+buy_shares: | |
id: 11 | |
context_id: 1 | |
project_id: 2 | |
@@ -155,7 +155,7 @@ | |
completed_at: ~ | |
user_id: 1 | |
-12: | |
+buy_stego_bait: | |
id: 12 | |
context_id: 1 | |
project_id: 3 | |
@@ -167,7 +167,7 @@ | |
completed_at: ~ | |
user_id: 1 | |
-13: | |
+new_action_in_context: | |
id: 13 | |
context_id: 1 | |
project_id: 3 | |
@@ -179,7 +179,7 @@ | |
completed_at: ~ | |
user_id: 1 | |
-14: | |
+call_stock_broker: | |
id: 14 | |
context_id: 2 | |
project_id: 2 | |
@@ -191,7 +191,7 @@ | |
completed_at: ~ | |
user_id: 1 | |
-15: | |
+select_delorean_model: | |
id: 15 | |
context_id: 6 | |
project_id: 1 | |
@@ -204,7 +204,7 @@ | |
show_from: <%= next_week %> | |
user_id: 1 | |
-16: | |
+buy_tix: | |
id: 16 | |
context_id: 10 | |
project_id: 4 | |
@@ -218,7 +218,7 @@ | |
user_id: 2 | |
-17: | |
+pal_confirmation: | |
id: 17 | |
context_id: 11 | |
project_id: 4 | |
@@ -231,7 +231,7 @@ | |
show_from: <%= next_week %> | |
user_id: 2 | |
-18: | |
+call_bill_gates_every_day: | |
id: 18 | |
user_id: 1 | |
context_id: 1 | |
@@ -243,4 +243,4 @@ | |
due: <%= last_week %> | |
completed_at: ~ | |
show_from: ~ | |
- recurring_todo_id: 1 | |
\ No newline at end of file | |
+ recurring_todo_id: 1 | |
Index: test/functional/backend_controller_test.rb | |
=================================================================== | |
--- test/functional/backend_controller_test.rb (revision 0) | |
+++ test/functional/backend_controller_test.rb (working copy) | |
@@ -4,7 +4,7 @@ | |
# Re-raise errors caught by the controller. | |
class BackendController; def rescue_action(e) raise e end; end | |
-class BackendControllerTest < Test::Rails::TestCase | |
+class BackendControllerTest < ActionController::TestCase | |
fixtures :users, :projects, :contexts, :todos, :recurring_todos, :notes | |
def setup | |
Index: test/functional/contexts_controller_test.rb | |
=================================================================== | |
--- test/functional/contexts_controller_test.rb (revision 0) | |
+++ test/functional/contexts_controller_test.rb (working copy) | |
@@ -186,4 +186,4 @@ | |
def protect_against_forgery? | |
false | |
end | |
-end | |
\ No newline at end of file | |
+end | |
Index: test/functional/data_controller_test.rb | |
=================================================================== | |
--- test/functional/data_controller_test.rb (revision 0) | |
+++ test/functional/data_controller_test.rb (working copy) | |
@@ -4,7 +4,7 @@ | |
# Re-raise errors caught by the controller. | |
class DataController; def rescue_action(e) raise e end; end | |
-class DataControllerTest < Test::Rails::TestCase | |
+class DataControllerTest < ActionController::TestCase | |
fixtures :users, :preferences, :projects, :notes | |
def setup | |
Index: test/functional/feedlist_controller_test.rb | |
=================================================================== | |
--- test/functional/feedlist_controller_test.rb (revision 0) | |
+++ test/functional/feedlist_controller_test.rb (working copy) | |
@@ -4,7 +4,7 @@ | |
# Re-raise errors caught by the controller. | |
class FeedlistController; def rescue_action(e) raise e end; end | |
-class FeedlistControllerTest < Test::Rails::TestCase | |
+class FeedlistControllerTest < ActionController::TestCase | |
fixtures :users, :preferences, :projects, :contexts, :todos, :recurring_todos, :notes | |
def setup | |
Index: test/functional/integrations_controller_test.rb | |
=================================================================== | |
--- test/functional/integrations_controller_test.rb (revision 0) | |
+++ test/functional/integrations_controller_test.rb (working copy) | |
@@ -4,7 +4,7 @@ | |
# Re-raise errors caught by the controller. | |
class IntegrationsController; def rescue_action(e) raise e end; end | |
-class IntegrationsControllerTest < Test::Unit::TestCase | |
+class IntegrationsControllerTest < ActionController::TestCase | |
fixtures :users, :preferences, :projects, :contexts, :todos, :recurring_todos, :tags, :taggings | |
def setup | |
Index: test/functional/login_controller_test.rb | |
=================================================================== | |
--- test/functional/login_controller_test.rb (revision 0) | |
+++ test/functional/login_controller_test.rb (working copy) | |
@@ -5,7 +5,7 @@ | |
# Re-raise errors caught by the controller. | |
class LoginController; def rescue_action(e) raise e end; end | |
-class LoginControllerTest < Test::Rails::TestCase | |
+class LoginControllerTest < ActionController::TestCase | |
fixtures :preferences, :users | |
def setup | |
Index: test/functional/notes_controller_test.rb | |
=================================================================== | |
--- test/functional/notes_controller_test.rb (revision 0) | |
+++ test/functional/notes_controller_test.rb (working copy) | |
@@ -4,7 +4,7 @@ | |
# Re-raise errors caught by the controller. | |
class NotesController; def rescue_action(e) raise e end; end | |
-class NotesControllerTest < Test::Rails::TestCase | |
+class NotesControllerTest < ActionController::TestCase | |
def setup | |
@controller = NotesController.new | |
request = ActionController::TestRequest.new | |
Index: test/functional/preferences_controller_test.rb | |
=================================================================== | |
--- test/functional/preferences_controller_test.rb (revision 0) | |
+++ test/functional/preferences_controller_test.rb (working copy) | |
@@ -5,7 +5,7 @@ | |
# Re-raise errors caught by the controller. | |
class PreferencesController; def rescue_action(e) raise e end; end | |
-class PreferencesControllerTest < Test::Rails::TestCase | |
+class PreferencesControllerTest < ActionController::TestCase | |
fixtures :users, :preferences | |
def setup | |
Index: test/functional/recurring_todos_controller_test.rb | |
=================================================================== | |
--- test/functional/recurring_todos_controller_test.rb (revision 0) | |
+++ test/functional/recurring_todos_controller_test.rb (working copy) | |
@@ -155,7 +155,7 @@ | |
"recurring_period"=>"yearly", | |
"recurring_show_days_before"=>"0", | |
"recurring_target"=>"due_date", | |
- "start_from"=>"", | |
+ "start_from"=>"1/10/2012", # adjust after 2012 | |
"weekly_every_x_week"=>"1", | |
"weekly_return_monday"=>"w", | |
"yearly_day_of_week"=>"0", | |
@@ -176,8 +176,8 @@ | |
new_todo = Todo.find_by_description("new recurring pattern") | |
assert !new_todo.nil? | |
- # the date should be 29 march 2009 | |
- assert_equal Time.zone.local(2009,3,29), new_todo.due | |
+ # the date should be 31 march 2013 | |
+ assert_equal Time.zone.local(2013,3,31), new_todo.due | |
end | |
end | |
Index: test/functional/stats_controller_test.rb | |
=================================================================== | |
--- test/functional/stats_controller_test.rb (revision 0) | |
+++ test/functional/stats_controller_test.rb (working copy) | |
@@ -4,7 +4,7 @@ | |
# Re-raise errors caught by the controller. | |
class StatsController; def rescue_action(e) raise e end; end | |
-class StatsControllerTest < Test::Unit::TestCase | |
+class StatsControllerTest < ActionController::TestCase | |
fixtures :users, :preferences, :projects, :contexts, :todos, :recurring_todos, :recurring_todos, :tags, :taggings | |
def setup | |
@@ -59,7 +59,7 @@ | |
assert_equal 16, assigns['actions'].count | |
assert_equal 4, assigns['tags_count'] | |
assert_equal 2, assigns['unique_tags_count'] | |
- assert_equal 2.week.ago.utc.beginning_of_day, assigns['first_action'].created_at | |
+ assert_equal 2.week.ago.beginning_of_day, assigns['first_action'].created_at | |
end | |
def test_downdrill | |
Index: test/functional/todo_container_controller_test_base.rb | |
=================================================================== | |
--- test/functional/todo_container_controller_test_base.rb (revision 0) | |
+++ test/functional/todo_container_controller_test_base.rb (working copy) | |
@@ -1,5 +1,10 @@ | |
-class TodoContainerControllerTestBase < Test::Rails::TestCase | |
+class TodoContainerControllerTestBase < ActionController::TestCase | |
+ def setup_controller_request_and_response | |
+ # override with empty | |
+ # TODO: remove these ugly hacks | |
+ end | |
+ | |
def perform_setup(container_class, controller_class) | |
@controller = controller_class.new | |
@request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new | |
Index: test/functional/todos_controller_test.rb | |
=================================================================== | |
--- test/functional/todos_controller_test.rb (revision 0) | |
+++ test/functional/todos_controller_test.rb (working copy) | |
@@ -4,7 +4,7 @@ | |
# Re-raise errors caught by the controller. | |
class TodosController; def rescue_action(e) raise e end; end | |
-class TodosControllerTest < Test::Rails::TestCase | |
+class TodosControllerTest < ActionController::TestCase | |
fixtures :users, :preferences, :projects, :contexts, :todos, :tags, :taggings, :recurring_todos | |
def setup | |
@@ -358,7 +358,7 @@ | |
"show_from(1i)"=>"", "show_from(2i)"=>"", "show_from(3i)"=>"", | |
"project_id"=>"1", | |
"notes"=>"test notes", "description"=>"test_mobile_create_action", "state"=>"0"}} | |
- assert_redirected_to '/m' | |
+ assert_redirected_to '/mobile' | |
end | |
def test_mobile_create_action_renders_new_template_when_save_fails | |
@@ -433,7 +433,7 @@ | |
# link todo_1 and recurring_todo_1 | |
recurring_todo_1 = RecurringTodo.find(1) | |
todo_1 = Todo.find_by_recurring_todo_id(1) | |
- today = Time.now.utc.at_midnight | |
+ today = Time.now.at_midnight | |
# change recurrence pattern to monthly and set show_from to today | |
recurring_todo_1.target = 'show_from_date' | |
@@ -470,7 +470,11 @@ | |
# check that the new_todo is in the tickler to show next month | |
assert !new_todo.show_from.nil? | |
- assert_equal Time.utc(today.year, today.month, today.day)+1.month, new_todo.show_from | |
+ | |
+ # use Time.zone.local and not today+1.month because the latter messes up | |
+ # the timezone. | |
+ next_month = Time.zone.local(today.year, today.month+1, today.day) | |
+ assert_equal next_month.to_s(:db), new_todo.show_from.to_s(:db) | |
end | |
def test_check_for_next_todo | |
Index: test/functional/users_controller_test.rb | |
=================================================================== | |
--- test/functional/users_controller_test.rb (revision 0) | |
+++ test/functional/users_controller_test.rb (working copy) | |
@@ -4,7 +4,7 @@ | |
# Re-raise errors caught by the controller. | |
class UsersController; def rescue_action(e) raise e end; end | |
-class UsersControllerTest < Test::Rails::TestCase | |
+class UsersControllerTest < ActionController::TestCase | |
fixtures :preferences, :users | |
def setup | |
@@ -51,10 +51,10 @@ | |
def test_destroy_user | |
login_as :admin_user | |
- @no_users_before = User.find(:all).size | |
- xhr :post, :destroy, :id => users(:ldap_user).to_param | |
+ nr_users_before = User.find(:all).size | |
+ xhr :post, :destroy, :id => users(:ldap_user).id.to_param | |
assert_rjs :page, "user-3", :remove | |
- assert_equal @no_users_before-1, User.find(:all).size | |
+ assert_equal nr_users_before-1, User.find(:all).size | |
end | |
def test_update_password_successful | |
Index: test/integration/users_xml_api_test.rb | |
=================================================================== | |
--- test/integration/users_xml_api_test.rb (revision 0) | |
+++ test/integration/users_xml_api_test.rb (working copy) | |
@@ -84,7 +84,7 @@ | |
end | |
def test_get_user_as_xml | |
- get "/users/#{users(:other_user).login}.xml", {}, basic_auth_headers() | |
+ get "/users/#{users(:other_user).id}.xml", {}, basic_auth_headers() | |
assert_response :success | |
assert_tag :tag => "user" | |
assert_no_tag :tag => "password" | |
@@ -104,4 +104,4 @@ | |
assert_response_and_body 404, "Expected post format is valid xml like so: <request><login>username</login><password>abc123</password></request>." | |
end | |
-end | |
\ No newline at end of file | |
+end | |
Index: test/test_helper.rb | |
=================================================================== | |
--- test/test_helper.rb (revision 0) | |
+++ test/test_helper.rb (working copy) | |
@@ -1,7 +1,7 @@ | |
ENV["RAILS_ENV"] = "test" | |
require File.expand_path(File.dirname(__FILE__) + "/../config/environment") | |
require File.expand_path(File.dirname(__FILE__) + "/../app/controllers/application") | |
-require 'test/rails' #you need the zentest gem installed | |
+require 'autotest/rails' #you need the zentest gem installed | |
require 'test_help' | |
require 'flexmock/test_unit' #and the flexmock gem, too! | |
require 'action_web_service/test_invoke' | |
@@ -41,21 +41,8 @@ | |
end | |
-class Test::Rails::HelperTestCase | |
- self.use_transactional_fixtures = false | |
- self.use_instantiated_fixtures = false | |
- | |
-end | |
- | |
-class Test::Rails::TestCase < Test::Unit::TestCase | |
- | |
- # Turn off transactional fixtures if you're working with MyISAM tables in MySQL | |
- self.use_transactional_fixtures = true | |
- | |
- # Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david) | |
- self.use_instantiated_fixtures = false | |
- | |
+class ActiveSupport::TestCase | |
# Generates a random string of ascii characters (a-z, "1 0") | |
# of a given length for testing assignment to fields | |
# for validation purposes | |
@@ -144,4 +131,4 @@ | |
assert_response_and_body 401, "401 Unauthorized: Only admin users are allowed access to this function." | |
end | |
-end | |
\ No newline at end of file | |
+end | |
Index: test/unit/context_test.rb | |
=================================================================== | |
--- test/unit/context_test.rb (revision 0) | |
+++ test/unit/context_test.rb (working copy) | |
@@ -1,6 +1,6 @@ | |
require File.dirname(__FILE__) + '/../test_helper' | |
-class ContextTest < Test::Rails::TestCase | |
+class ContextTest < ActiveSupport::TestCase | |
fixtures :contexts, :todos, :recurring_todos, :users, :preferences | |
def setup | |
Index: test/unit/message_gateway_test.rb | |
=================================================================== | |
--- test/unit/message_gateway_test.rb (revision 0) | |
+++ test/unit/message_gateway_test.rb (working copy) | |
@@ -1,7 +1,7 @@ | |
require File.dirname(__FILE__) + '/../test_helper' | |
-class MessageGatewayTest < Test::Rails::TestCase | |
- fixtures :users, :contexts | |
+class MessageGatewayTest < ActiveSupport::TestCase | |
+ fixtures :users, :contexts, :todos | |
def setup | |
@user = users(:sms_user) | |
Index: test/unit/notes_test.rb | |
=================================================================== | |
--- test/unit/notes_test.rb (revision 0) | |
+++ test/unit/notes_test.rb (working copy) | |
@@ -1,6 +1,6 @@ | |
require File.dirname(__FILE__) + '/../test_helper' | |
-class NotesTest < Test::Rails::TestCase | |
+class NotesTest < ActiveSupport::TestCase | |
fixtures :notes | |
def setup | |
Index: test/unit/preference_test.rb | |
=================================================================== | |
--- test/unit/preference_test.rb (revision 0) | |
+++ test/unit/preference_test.rb (working copy) | |
@@ -1,6 +1,6 @@ | |
require File.dirname(__FILE__) + '/../test_helper' | |
-class PreferenceTest < Test::Rails::TestCase | |
+class PreferenceTest < ActiveSupport::TestCase | |
fixtures :users, :preferences | |
def setup | |
Index: test/unit/project_test.rb | |
=================================================================== | |
--- test/unit/project_test.rb (revision 0) | |
+++ test/unit/project_test.rb (working copy) | |
@@ -1,6 +1,6 @@ | |
require File.dirname(__FILE__) + '/../test_helper' | |
-class ProjectTest < Test::Rails::TestCase | |
+class ProjectTest < ActiveSupport::TestCase | |
fixtures :projects, :contexts, :todos, :recurring_todos, :users, :preferences | |
def setup | |
Index: test/unit/prototype_helper_extensions_test.rb | |
=================================================================== | |
--- test/unit/prototype_helper_extensions_test.rb (revision 0) | |
+++ test/unit/prototype_helper_extensions_test.rb (working copy) | |
@@ -1,7 +1,7 @@ | |
require File.dirname(__FILE__) + '/../test_helper' | |
require File.dirname(__FILE__) + '/../../lib/prototype_helper_extensions' | |
-class PrototypeHelperExtensionsTest < Test::Unit::TestCase | |
+class PrototypeHelperExtensionsTest < ActiveSupport::TestCase | |
include ActionView::Helpers::JavaScriptHelper | |
include ActionView::Helpers::PrototypeHelper | |
include ActionView::Helpers::ScriptaculousHelper | |
Index: test/unit/recurring_todo_test.rb | |
=================================================================== | |
--- test/unit/recurring_todo_test.rb (revision 0) | |
+++ test/unit/recurring_todo_test.rb (working copy) | |
@@ -1,6 +1,6 @@ | |
require File.dirname(__FILE__) + '/../test_helper' | |
-class RecurringTodoTest < Test::Rails::TestCase | |
+class RecurringTodoTest < ActiveSupport::TestCase | |
fixtures :todos, :users, :contexts, :preferences, :tags, :taggings, :recurring_todos | |
def setup | |
@@ -81,6 +81,7 @@ | |
assert_equal true, @every_day.has_next_todo(@in_three_days) | |
assert_equal true, @every_day.has_next_todo(@in_four_days) | |
@every_day.end_date = @in_four_days | |
+ @every_day.ends_on = 'ends_on_end_date' | |
assert_equal false, @every_day.has_next_todo(@in_four_days) | |
end | |
Index: test/unit/tag_test.rb | |
=================================================================== | |
--- test/unit/tag_test.rb (revision 0) | |
+++ test/unit/tag_test.rb (working copy) | |
@@ -1,6 +1,6 @@ | |
require File.dirname(__FILE__) + '/../test_helper' | |
-class TagTest < Test::Rails::TestCase | |
+class TagTest < ActiveSupport::TestCase | |
fixtures :tags | |
# Replace this with your real tests. | |
Index: test/unit/tagging_test.rb | |
=================================================================== | |
--- test/unit/tagging_test.rb (revision 0) | |
+++ test/unit/tagging_test.rb (working copy) | |
@@ -1,6 +1,6 @@ | |
require File.dirname(__FILE__) + '/../test_helper' | |
-class TaggingTest < Test::Rails::TestCase | |
+class TaggingTest < ActiveSupport::TestCase | |
fixtures :taggings | |
# Replace this with your real tests. | |
Index: test/unit/todo_create_params_helper_test.rb | |
=================================================================== | |
--- test/unit/todo_create_params_helper_test.rb (revision 0) | |
+++ test/unit/todo_create_params_helper_test.rb (working copy) | |
@@ -1,7 +1,7 @@ | |
require File.dirname(__FILE__) + '/../test_helper' | |
require 'todos_controller' | |
-class TodoCreateParamsHelperTest < Test::Rails::TestCase | |
+class TodoCreateParamsHelperTest < ActiveSupport::TestCase | |
def test_works_with_request_as_root_hash_entry | |
params = {'request' => { 'todo' => { 'description' => 'foo'}}} | |
@@ -133,4 +133,4 @@ | |
assert_equal false, params_helper.context_specified_by_name? | |
end | |
-end | |
\ No newline at end of file | |
+end | |
Index: test/unit/todo_test.rb | |
=================================================================== | |
--- test/unit/todo_test.rb (revision 0) | |
+++ test/unit/todo_test.rb (working copy) | |
@@ -1,7 +1,7 @@ | |
require File.dirname(__FILE__) + '/../test_helper' | |
require 'date' | |
-class TodoTest < Test::Rails::TestCase | |
+class TodoTest < ActiveSupport::TestCase | |
fixtures :todos, :recurring_todos, :users, :contexts, :preferences, :tags, :taggings | |
def setup | |
Index: test/unit/user_test.rb | |
=================================================================== | |
--- test/unit/user_test.rb (revision 0) | |
+++ test/unit/user_test.rb (working copy) | |
@@ -16,7 +16,7 @@ | |
end | |
end | |
-class UserTest < Test::Rails::TestCase | |
+class UserTest < ActiveSupport::TestCase | |
fixtures :users, :preferences, :projects, :contexts, :todos, :recurring_todos | |
def setup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment