diff --git a/tracks/app/controllers/admin_controller.rb b/tracks/app/controllers/admin_controller.rb index 66b0e68e..bed5b10f 100644 --- a/tracks/app/controllers/admin_controller.rb +++ b/tracks/app/controllers/admin_controller.rb @@ -41,7 +41,7 @@ class AdminController < ApplicationController def admin_login_required unless User.find_by_id_and_is_admin(session['user_id'], true) notify :error, "Only admin users are allowed access to this function" - redirect_to :controller => 'todo', :action => 'index' + redirect_to home_path return false end end diff --git a/tracks/app/controllers/contexts_controller.rb b/tracks/app/controllers/contexts_controller.rb index 05fc3c5b..9ee95aaf 100644 --- a/tracks/app/controllers/contexts_controller.rb +++ b/tracks/app/controllers/contexts_controller.rb @@ -1,6 +1,6 @@ class ContextsController < ApplicationController - helper :todo + helper :todos before_filter :init, :except => [:create, :destroy, :order] before_filter :init_todos, :only => :show diff --git a/tracks/app/controllers/login_controller.rb b/tracks/app/controllers/login_controller.rb index f2621303..2aa68589 100644 --- a/tracks/app/controllers/login_controller.rb +++ b/tracks/app/controllers/login_controller.rb @@ -18,7 +18,7 @@ class LoginController < ApplicationController msg = (should_expire_sessions?) ? "will expire after 1 hour of inactivity." : "will not expire." notify :notice, "Login successful: session #{msg}" cookies[:tracks_login] = { :value => @user.login, :expires => Time.now + 1.year } - redirect_back_or_default :controller => "todo", :action => "index" + redirect_back_or_default home_url else @login = params['user_login'] notify :warning, "Login unsuccessful" @@ -69,7 +69,7 @@ class LoginController < ApplicationController unless (@user.nil?) notify :notice, "You have successfully verified #{open_id_response.identity_url} as your identity." session['user_id'] = @user.id - redirect_back_or_default :controller => 'todo', :action => 'index' + redirect_back_or_default home_path else notify :warning, "You have successfully verified #{open_id_response.identity_url} as your identity, but you do not have a Tracks account. Please ask your administrator to sign you up." end @@ -111,7 +111,7 @@ class LoginController < ApplicationController @user.create_preference @user.save notify :notice, "Signup successful for user #{@user.login}." - redirect_back_or_default :controller => "todo", :action => "index" + redirect_back_or_default home_url end end @@ -121,7 +121,7 @@ class LoginController < ApplicationController # TODO: Maybe it would be better to mark deleted. That way user deletes can be reversed. @user.destroy end - redirect_back_or_default :controller => "todo", :action => "index" + redirect_back_or_default home_url end def logout diff --git a/tracks/app/controllers/projects_controller.rb b/tracks/app/controllers/projects_controller.rb index f38f4a46..b3ed580a 100644 --- a/tracks/app/controllers/projects_controller.rb +++ b/tracks/app/controllers/projects_controller.rb @@ -1,6 +1,6 @@ class ProjectsController < ApplicationController - helper :todo, :notes + helper :todos, :notes before_filter :init, :except => [:create, :destroy, :order] def index diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todos_controller.rb similarity index 97% rename from tracks/app/controllers/todo_controller.rb rename to tracks/app/controllers/todos_controller.rb index d87db7d6..df03d4be 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todos_controller.rb @@ -1,6 +1,6 @@ -class TodoController < ApplicationController +class TodosController < ApplicationController - helper :todo + helper :todos append_before_filter :init, :except => [ :destroy, :completed, :completed_archive, :check_tickler ] layout 'standard' @@ -222,7 +222,7 @@ class TodoController < ApplicationController @done_archive = @done.completed_more_than 28.day.ago.utc end - def tickler + def list_deferred @source_view = 'deferred' @page_title = "TRACKS::Tickler" @tickles = @user.deferred_todos @@ -234,15 +234,15 @@ class TodoController < ApplicationController def check_tickler @due_tickles = @user.deferred_todos.find_and_activate_ready respond_to do |format| - format.html { redirect_to :controller => 'todo', :action => 'index' } + format.html { redirect_to home_path } format.js end end - # /todo/tag/[tag_name] shows all the actions tagged with tag_name + # /todos/tag/[tag_name] shows all the actions tagged with tag_name # def tag - @tag = tag_name = params[:id] + @tag = tag_name = params[:name] if Tag.find_by_name(tag_name) @todos = Todo.find_tagged_with(tag_name, @user) else diff --git a/tracks/app/helpers/feed_helper.rb b/tracks/app/helpers/feed_helper.rb index e9581f5f..ed630644 100644 --- a/tracks/app/helpers/feed_helper.rb +++ b/tracks/app/helpers/feed_helper.rb @@ -63,7 +63,7 @@ module FeedHelper end def format_ical_uid(todo) - sprintf("%s%s%s%s", @request.protocol, @request.host, @request.port_string, url_for(:controller => 'todo', :action => 'show', :id => todo.id)) + sprintf("%s%s%s%s", @request.protocol, @request.host, @request.port_string, todo_url(todo)) end end diff --git a/tracks/app/helpers/todo_helper.rb b/tracks/app/helpers/todos_helper.rb similarity index 87% rename from tracks/app/helpers/todo_helper.rb rename to tracks/app/helpers/todos_helper.rb index c2c97a9f..50b3f547 100644 --- a/tracks/app/helpers/todo_helper.rb +++ b/tracks/app/helpers/todos_helper.rb @@ -1,4 +1,4 @@ -module TodoHelper +module TodosHelper require 'user_controller' # Counts the number of uncompleted items in the specified context @@ -8,22 +8,25 @@ module TodoHelper end def form_remote_tag_edit_todo( item, &block ) - form_remote_tag( :url => { :controller => 'todo', :action => 'update', :id => item.id }, + form_remote_tag( :url => todo_path(item), :method => :put, :html => { :id => dom_id(item, 'form'), :class => "inline-form" }, &block ) end def link_to_remote_todo(item) - url_options = { :controller => 'todo', :action => 'destroy', :id => item.id, :_source_view => @source_view } + itemurl = todo_path(:id => item.id, :_source_view => @source_view) str = link_to_remote( image_tag_for_delete, - { :url => url_options, :confirm => "Are you sure that you want to delete the action, \'#{item.description}\'?" }, + { :url => todo_path(:id => item.id, :_source_view => @source_view), + :method => :delete, + :confirm => "Are you sure that you want to delete the action, \'#{item.description}\'?" }, { :class => "icon" } ) + "\n" if !item.completed? - url_options[:action] = 'edit' str << link_to_remote( image_tag_for_edit(item), - { :url => url_options, :loading => visual_effect(:pulsate, dom_id(item, 'edit_icon')) }, + { :url => edit_todo_path(:id => item.id, :_source_view => @source_view), + :method => 'get', + :loading => visual_effect(:pulsate, dom_id(item, 'edit_icon')) }, { :class => "icon" } ) else diff --git a/tracks/app/views/contexts/_context.rhtml b/tracks/app/views/contexts/_context.rhtml index f6851c56..c1296fc7 100644 --- a/tracks/app/views/contexts/_context.rhtml +++ b/tracks/app/views/contexts/_context.rhtml @@ -14,6 +14,6 @@

Currently there are no uncompleted actions in this context

-<%= render :partial => "todo/item", :collection => @not_done, :locals => { :parent_container_type => "context" } %> +<%= render :partial => "todos/item", :collection => @not_done, :locals => { :parent_container_type => "context" } %> diff --git a/tracks/app/views/contexts/show.rhtml b/tracks/app/views/contexts/show.rhtml index fd7bd72e..aeacc494 100644 --- a/tracks/app/views/contexts/show.rhtml +++ b/tracks/app/views/contexts/show.rhtml @@ -1,6 +1,6 @@
<%= render :partial => "contexts/context", :locals => { :context => @context, :collapsible => false } %> -<%= render :partial => "todo/completed", :locals => { :done => @done, :collapsible => false, :append_descriptor => "in this context (last #{@user.prefs.show_number_completed})" } %> +<%= render :partial => "todos/completed", :locals => { :done => @done, :collapsible => false, :append_descriptor => "in this context (last #{@user.prefs.show_number_completed})" } %>
diff --git a/tracks/app/views/feed/rss.rxml b/tracks/app/views/feed/rss.rxml index bb47cf0a..f1789351 100644 --- a/tracks/app/views/feed/rss.rxml +++ b/tracks/app/views/feed/rss.rxml @@ -1,7 +1,7 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do xml.channel do xml.title(@title) - xml.link("http://#{request.host}:#{request.port}/todo/list") + xml.link("http://#{request.host}:#{request.port}/todos/list") xml.description(@description) @todos.each do |i| xml.item do @@ -9,7 +9,7 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do xml.link(context_url(i.context)) item_notes = sanitize(markdown( i.notes )) if i.notes? due = "
Due: #{format_date(i.due)}
\n" if i.due? - toggle_link = link_to( "mark as done", {:only_path => false, :controller => "todo", :action => "toggle_check", :id => i.id}) + toggle_link = link_to( "mark as done", {:only_path => false, :controller => "todos", :action => "toggle_check", :id => i.id}) done = "
#{toggle_link}
" unless i.completed? done = "
Completed: #{format_date(i.completed_at)}
\n" if i.completed? context_link = link_to( i.context.name, context_url(i.context) ) diff --git a/tracks/app/views/layouts/standard.rhtml b/tracks/app/views/layouts/standard.rhtml index ac2a673c..34cde936 100644 --- a/tracks/app/views/layouts/standard.rhtml +++ b/tracks/app/views/layouts/standard.rhtml @@ -40,11 +40,11 @@ diff --git a/tracks/app/views/projects/_project.rhtml b/tracks/app/views/projects/_project.rhtml index 034f0b47..556060b4 100644 --- a/tracks/app/views/projects/_project.rhtml +++ b/tracks/app/views/projects/_project.rhtml @@ -20,6 +20,6 @@

Currently there are no uncompleted actions in this project

- <%= render :partial => "todo/item", :collection => @not_done, :locals => { :parent_container_type => "project" } %> + <%= render :partial => "todos/item", :collection => @not_done, :locals => { :parent_container_type => "project" } %> diff --git a/tracks/app/views/projects/show.rhtml b/tracks/app/views/projects/show.rhtml index 266c7447..52488f07 100644 --- a/tracks/app/views/projects/show.rhtml +++ b/tracks/app/views/projects/show.rhtml @@ -1,8 +1,8 @@
<%= render :partial => "projects/project", :locals => { :project => @project, :collapsible => false } %> -<%= render :partial => "todo/deferred", :locals => { :deferred => @deferred, :collapsible => false, :append_descriptor => "in this project" } %> -<%= render :partial => "todo/completed", :locals => { :done => @done, :collapsible => false, :append_descriptor => "in this project" } %> +<%= render :partial => "todos/deferred", :locals => { :deferred => @deferred, :collapsible => false, :append_descriptor => "in this project" } %> +<%= render :partial => "todos/completed", :locals => { :done => @done, :collapsible => false, :append_descriptor => "in this project" } %>
diff --git a/tracks/app/views/shared/_add_new_item_form.rhtml b/tracks/app/views/shared/_add_new_item_form.rhtml index 30c58da4..0669dc85 100644 --- a/tracks/app/views/shared/_add_new_item_form.rhtml +++ b/tracks/app/views/shared/_add_new_item_form.rhtml @@ -12,7 +12,7 @@ <% form_remote_tag( - :url => { :controller => "todo", :action => "create" }, + :url => todos_path, :method => :post, :html=> { :id=>'todo-form-new-action', :name=>'todo', :class => 'inline-form' }) do -%>
<%= error_messages_for("item") %>
diff --git a/tracks/app/views/todo/_completed.rhtml b/tracks/app/views/todos/_completed.rhtml similarity index 83% rename from tracks/app/views/todo/_completed.rhtml rename to tracks/app/views/todos/_completed.rhtml index 476b3e83..d28a2d5b 100644 --- a/tracks/app/views/todo/_completed.rhtml +++ b/tracks/app/views/todos/_completed.rhtml @@ -12,6 +12,6 @@

Currently there are no completed actions.

- <%= render :partial => "todo/item", :collection => done, :locals => { :parent_container_type => "completed" } %> + <%= render :partial => "todos/item", :collection => done, :locals => { :parent_container_type => "completed" } %>
\ No newline at end of file diff --git a/tracks/app/views/todo/_deferred.rhtml b/tracks/app/views/todos/_deferred.rhtml similarity index 82% rename from tracks/app/views/todo/_deferred.rhtml rename to tracks/app/views/todos/_deferred.rhtml index 62a3484c..f21bbc41 100644 --- a/tracks/app/views/todo/_deferred.rhtml +++ b/tracks/app/views/todos/_deferred.rhtml @@ -12,7 +12,7 @@

Currently there are no deferred actions

- <%= render :partial => "todo/item", :collection => deferred, :locals => { :parent_container_type => 'tickler' } %> + <%= render :partial => "todos/item", :collection => deferred, :locals => { :parent_container_type => 'tickler' } %> \ No newline at end of file diff --git a/tracks/app/views/todo/_done.rhtml b/tracks/app/views/todos/_done.rhtml similarity index 88% rename from tracks/app/views/todo/_done.rhtml rename to tracks/app/views/todos/_done.rhtml index a40b5dcc..3c28bbf7 100644 --- a/tracks/app/views/todo/_done.rhtml +++ b/tracks/app/views/todos/_done.rhtml @@ -15,7 +15,7 @@ <% end %> <% if done.notes? -%> - <%= render :partial => "todo/toggle_notes", :locals => { :item => done } %> + <%= render :partial => "todos/toggle_notes", :locals => { :item => done } %> <% end -%> <% end %> diff --git a/tracks/app/views/todo/_edit_form.rhtml b/tracks/app/views/todos/_edit_form.rhtml similarity index 100% rename from tracks/app/views/todo/_edit_form.rhtml rename to tracks/app/views/todos/_edit_form.rhtml diff --git a/tracks/app/views/todo/_item.rhtml b/tracks/app/views/todos/_item.rhtml similarity index 89% rename from tracks/app/views/todo/_item.rhtml rename to tracks/app/views/todos/_item.rhtml index b985d3e5..c8c9dac1 100644 --- a/tracks/app/views/todo/_item.rhtml +++ b/tracks/app/views/todos/_item.rhtml @@ -4,7 +4,7 @@ <% unless source_view_is :deferred -%> checked="checked" <% end %> /> <% end -%> @@ -50,7 +50,7 @@ <% end -%> <% if item.notes? -%> - <%= render :partial => "todo/toggle_notes", :locals => { :item => item } %> + <%= render :partial => "todos/toggle_notes", :locals => { :item => item } %> <% end -%> diff --git a/tracks/app/views/todo/_toggle_notes.rhtml b/tracks/app/views/todos/_toggle_notes.rhtml similarity index 100% rename from tracks/app/views/todo/_toggle_notes.rhtml rename to tracks/app/views/todos/_toggle_notes.rhtml diff --git a/tracks/app/views/todo/check_tickler.rjs b/tracks/app/views/todos/check_tickler.rjs similarity index 100% rename from tracks/app/views/todo/check_tickler.rjs rename to tracks/app/views/todos/check_tickler.rjs diff --git a/tracks/app/views/todo/completed.rhtml b/tracks/app/views/todos/completed.rhtml similarity index 86% rename from tracks/app/views/todo/completed.rhtml rename to tracks/app/views/todos/completed.rhtml index cd8be91c..2086db79 100644 --- a/tracks/app/views/todo/completed.rhtml +++ b/tracks/app/views/todos/completed.rhtml @@ -21,5 +21,5 @@ -

Older completed items: <%= link_to( "Older than 31 days", :controller => "todo", :action => "completed_archive" ) %>

+

Older completed items: <%= link_to( "Older than 31 days", done_archive_path ) %>

diff --git a/tracks/app/views/todo/completed_archive.rhtml b/tracks/app/views/todos/completed_archive.rhtml similarity index 100% rename from tracks/app/views/todo/completed_archive.rhtml rename to tracks/app/views/todos/completed_archive.rhtml diff --git a/tracks/app/views/todo/create.rjs b/tracks/app/views/todos/create.rjs similarity index 92% rename from tracks/app/views/todo/create.rjs rename to tracks/app/views/todos/create.rjs index 67c35293..5d4695d5 100644 --- a/tracks/app/views/todo/create.rjs +++ b/tracks/app/views/todos/create.rjs @@ -14,7 +14,7 @@ if @saved page.insert_html :top, 'display_box', :partial => 'contexts/context', :locals => { :context => @item.context, :collapsible => true } else page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@item.context_id}" if source_view_is(:todo) - page.insert_html :bottom, item_container_id, :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type, :source_view => @source_view } + page.insert_html :bottom, item_container_id, :partial => 'todos/item', :locals => { :parent_container_type => parent_container_type, :source_view => @source_view } page.visual_effect :highlight, dom_id(@item), :duration => 3 page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil? end diff --git a/tracks/app/views/todo/destroy.rjs b/tracks/app/views/todos/destroy.rjs similarity index 100% rename from tracks/app/views/todo/destroy.rjs rename to tracks/app/views/todos/destroy.rjs diff --git a/tracks/app/views/todo/edit.rjs b/tracks/app/views/todos/edit.rjs similarity index 63% rename from tracks/app/views/todo/edit.rjs rename to tracks/app/views/todos/edit.rjs index 47e1a494..3712fe66 100644 --- a/tracks/app/views/todo/edit.rjs +++ b/tracks/app/views/todos/edit.rjs @@ -1,4 +1,4 @@ -page[dom_id(@item, 'form')].replace_html :partial => 'todo/edit_form' +page[dom_id(@item, 'form')].replace_html :partial => 'todos/edit_form' page[dom_id(@item, 'line')].hide page[dom_id(@item, 'edit')].show page.call "Form.focusFirstElement", dom_id(@item, 'form') diff --git a/tracks/app/views/todo/error.rjs b/tracks/app/views/todos/error.rjs similarity index 100% rename from tracks/app/views/todo/error.rjs rename to tracks/app/views/todos/error.rjs diff --git a/tracks/app/views/todo/index.rhtml b/tracks/app/views/todos/index.rhtml similarity index 90% rename from tracks/app/views/todo/index.rhtml rename to tracks/app/views/todos/index.rhtml index a4c6405c..8a615d0e 100644 --- a/tracks/app/views/todo/index.rhtml +++ b/tracks/app/views/todos/index.rhtml @@ -3,7 +3,7 @@ <%= render :partial => "contexts/context", :collection => @contexts_to_show, :locals => { :collapsible => true } %> <% unless @done.nil? -%> - <%= render :partial => "todo/completed", + <%= render :partial => "todos/completed", :locals => { :done => @done, :collapsible => true, :append_descriptor => nil } %> <% end -%> diff --git a/tracks/app/views/todo/list.rxml b/tracks/app/views/todos/list.rxml similarity index 100% rename from tracks/app/views/todo/list.rxml rename to tracks/app/views/todos/list.rxml diff --git a/tracks/app/views/todos/list_deferred.rhtml b/tracks/app/views/todos/list_deferred.rhtml new file mode 100644 index 00000000..5db5e96d --- /dev/null +++ b/tracks/app/views/todos/list_deferred.rhtml @@ -0,0 +1,21 @@ +
+ +
+

Deferred actions

+ +
+
+

Currently there are no deferred actions

+
+ + <%= render :partial => "todos/item", :collection => @tickles, :locals => { :parent_container_type => 'tickler' } %> + +
+
+ +
+ +
+ <%= render :partial => "shared/add_new_item_form" %> + <%= render "sidebar/sidebar" %> +
\ No newline at end of file diff --git a/tracks/app/views/todo/tag.rhtml b/tracks/app/views/todos/tag.rhtml similarity index 84% rename from tracks/app/views/todo/tag.rhtml rename to tracks/app/views/todos/tag.rhtml index 2a5b76d5..661cc299 100644 --- a/tracks/app/views/todo/tag.rhtml +++ b/tracks/app/views/todos/tag.rhtml @@ -8,7 +8,7 @@

Currently there are no actions tagged with <%= @tag %>

- <%= render :partial => "todo/item", :collection => @todos, :locals => { :parent_container_type => "tag" } %> + <%= render :partial => "todos/item", :collection => @todos, :locals => { :parent_container_type => "tag" } %> diff --git a/tracks/app/views/todo/tickler.rhtml b/tracks/app/views/todos/tickler.rhtml similarity index 100% rename from tracks/app/views/todo/tickler.rhtml rename to tracks/app/views/todos/tickler.rhtml diff --git a/tracks/app/views/todo/toggle_check.rjs b/tracks/app/views/todos/toggle_check.rjs similarity index 88% rename from tracks/app/views/todo/toggle_check.rjs rename to tracks/app/views/todos/toggle_check.rjs index c0b69ac6..b9d3209a 100644 --- a/tracks/app/views/todo/toggle_check.rjs +++ b/tracks/app/views/todos/toggle_check.rjs @@ -3,7 +3,7 @@ if @saved if @item.completed? # Don't try to insert contents into a non-existent container! unless @user.prefs.hide_completed_actions? - page.insert_html :top, "completed", :partial => 'todo/item', :locals => { :parent_container_type => "completed" } + page.insert_html :top, "completed", :partial => 'todos/item', :locals => { :parent_container_type => "completed" } page.visual_effect :highlight, dom_id(@item, 'line'), {'startcolor' => "'#99ff99'"} page[empty_container_msg_div_id].show if @down_count == 0 && !empty_container_msg_div_id.nil? page.show 'tickler-empty-nd' if source_view_is(:project) && @deferred_count == 0 @@ -14,7 +14,7 @@ if @saved end else page.call "todoItems.ensureVisibleWithEffectAppear", item_container_id - page.insert_html :bottom, item_container_id, :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type } + page.insert_html :bottom, item_container_id, :partial => 'todos/item', :locals => { :parent_container_type => parent_container_type } page.visual_effect :highlight, dom_id(@item, 'line'), {'startcolor' => "'#99ff99'"} page.show "empty-d" if @completed_count == 0 page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil? # If we've checked something as undone, uncompleted items can't be empty diff --git a/tracks/app/views/todo/update.rjs b/tracks/app/views/todos/update.rjs similarity index 82% rename from tracks/app/views/todo/update.rjs rename to tracks/app/views/todos/update.rjs index e906550c..77b96adc 100644 --- a/tracks/app/views/todo/update.rjs +++ b/tracks/app/views/todos/update.rjs @@ -18,7 +18,7 @@ if @saved if source_view_is(:todo) && @item.active? page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@item.context_id}" page.call "todoItems.expandNextActionListingByContext", "c#{@item.context_id}items", true - page.insert_html :bottom, "c#{@item.context_id}items", :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type } + page.insert_html :bottom, "c#{@item.context_id}items", :partial => 'todos/item', :locals => { :parent_container_type => parent_container_type } end page.replace_html("badge_count", @remaining_undone_in_context) if source_view_is :context page.delay(0.5) do @@ -29,7 +29,7 @@ if @saved end end else - page.replace dom_id(@item), :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type } + page.replace dom_id(@item), :partial => 'todos/item', :locals => { :parent_container_type => parent_container_type } page.visual_effect :highlight, dom_id(@item), :duration => 3 end elsif source_view_is :project @@ -40,22 +40,22 @@ if @saved elsif @item.deferred? page[@item].remove page.show("p#{@original_item_project_id}empty-nd") if (@remaining_undone_in_project == 0) - page.insert_html :bottom, "tickler", :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type } + page.insert_html :bottom, "tickler", :partial => 'todos/item', :locals => { :parent_container_type => parent_container_type } page['tickler-empty-nd'].hide page.replace_html "badge_count", @remaining_undone_in_project elsif @item_was_activated_from_deferred_state page[@item].remove page['tickler-empty-nd'].show if (@deferred_count == 0) - page.insert_html :bottom, "p#{@item.project_id}", :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type } + page.insert_html :bottom, "p#{@item.project_id}", :partial => 'todos/item', :locals => { :parent_container_type => parent_container_type } page["p#{@item.project_id}empty-nd"].hide page.replace_html "badge_count", @remaining_undone_in_project else - page.replace dom_id(@item), :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type } + page.replace dom_id(@item), :partial => 'todos/item', :locals => { :parent_container_type => parent_container_type } page.visual_effect :highlight, dom_id(@item), :duration => 3 end elsif source_view_is :deferred if @item.deferred? - page.replace dom_id(@item), :partial => 'todo/item', :locals => { :parent_container_type => parent_container_type } + page.replace dom_id(@item), :partial => 'todos/item', :locals => { :parent_container_type => parent_container_type } page.visual_effect :highlight, dom_id(@item), :duration => 3 else page[@item].remove diff --git a/tracks/config/routes.rb b/tracks/config/routes.rb index e4a354e6..615e62e1 100644 --- a/tracks/config/routes.rb +++ b/tracks/config/routes.rb @@ -14,9 +14,7 @@ ActionController::Routing::Routes.draw do |map| # instead of a file named 'wsdl' #map.connect ':controller/service.wsdl', :action => 'wsdl' - # Index Route - map.connect '', :controller => 'todo', :action => 'index' - + # Admin Routes map.connect 'admin', :controller => 'admin', :action => 'index' map.connect 'admin/destroy/:id', :controller => 'admin', :action => 'destroy', :requirements => {:id => /\d+/} @@ -31,8 +29,15 @@ ActionController::Routing::Routes.draw do |map| map.connect 'signup', :controller => 'login', :action => 'signup' # ToDo Routes - map.connect 'done', :controller => 'todo', :action => 'completed' - map.connect 'tickler', :controller => 'todo', :action => 'tickler' + map.resources :todos, :member => {:toggle_check => :post} + map.with_options :controller => "todos" do |todos| + todos.home '', :action => "index" + todos.tickler 'tickler', :action => "list_deferred" + todos.check_tickler 'check_tickler', :action => "check_tickler" + todos.done 'done', :action => "completed" + todos.done_archive 'done/archive', :action => "completed_archive" + todos.tag '/todos/tag/:name', :action => "tag" + end # Context Routes map.resources :contexts, :collection => {:order => :post} diff --git a/tracks/test/functional/admin_controller_test.rb b/tracks/test/functional/admin_controller_test.rb index ff33052a..7d5485e0 100644 --- a/tracks/test/functional/admin_controller_test.rb +++ b/tracks/test/functional/admin_controller_test.rb @@ -21,7 +21,7 @@ class AdminControllerTest < Test::Unit::TestCase def test_get_index_by_nonadmin @request.session['user_id'] = users(:other_user).id get :index - assert_redirected_to :controller => 'todo', :action => 'index' + assert_redirected_to home_path end def test_get_index_by_admin diff --git a/tracks/test/functional/login_controller_test.rb b/tracks/test/functional/login_controller_test.rb index b698385a..dba99187 100644 --- a/tracks/test/functional/login_controller_test.rb +++ b/tracks/test/functional/login_controller_test.rb @@ -44,7 +44,7 @@ class LoginControllerTest < Test::Unit::TestCase assert_equal user.login, "jane" assert user.is_admin == false || user.is_admin == 0 assert_equal "Login successful: session will expire after 1 hour of inactivity.", flash[:notice] - assert_redirected_to :controller => 'todo', :action => 'index' + assert_redirected_to home_url end def test_login_with_no_users_redirects_to_signup @@ -88,14 +88,14 @@ class LoginControllerTest < Test::Unit::TestCase assert admin.is_admin newbie = create('newbie', 'newbiepass') assert_equal "Signup successful for user newbie.", flash[:notice] - assert_redirected_to :controller => 'todo', :action => 'index' + assert_redirected_to home_url assert_valid newbie get :logout # logout the admin user assert_equal newbie.login, "newbie" assert newbie.is_admin == false || newbie.is_admin == 0 assert_not_nil newbie.preference # have user preferences been created? user = login('newbie', 'newbiepass', 'on') # log in the new user - assert_redirected_to :controller => 'todo', :action => 'index' + assert_redirected_to home_url assert_equal 'newbie', user.login assert user.is_admin == false || user.is_admin == 0 assert_equal User.count, @num_users_in_fixture + 1 diff --git a/tracks/test/functional/todo_controller_test.rb b/tracks/test/functional/todos_controller_test.rb similarity index 94% rename from tracks/test/functional/todo_controller_test.rb rename to tracks/test/functional/todos_controller_test.rb index f628cf8c..ba02daaa 100644 --- a/tracks/test/functional/todo_controller_test.rb +++ b/tracks/test/functional/todos_controller_test.rb @@ -1,14 +1,14 @@ require File.dirname(__FILE__) + '/../test_helper' -require 'todo_controller' +require 'todos_controller' # Re-raise errors caught by the controller. -class TodoController; def rescue_action(e) raise e end; end +class TodosController; def rescue_action(e) raise e end; end -class TodoControllerTest < Test::Unit::TestCase +class TodosControllerTest < Test::Unit::TestCase fixtures :users, :preferences, :projects, :contexts, :todos, :tags, :taggings def setup - @controller = TodoController.new + @controller = TodosController.new @request, @response = ActionController::TestRequest.new, ActionController::TestResponse.new end diff --git a/tracks/test/integration/stories_test.rb b/tracks/test/integration/stories_test.rb index 0fb6edde..80b918b4 100644 --- a/tracks/test/integration/stories_test.rb +++ b/tracks/test/integration/stories_test.rb @@ -37,7 +37,7 @@ class StoriesTest < ActionController::IntegrationTest assert_response :redirect follow_redirect! assert_response :success - assert_template "todo/index" + assert_template "todos/index" end def goes_to_login @@ -63,7 +63,7 @@ class StoriesTest < ActionController::IntegrationTest assert_response :redirect follow_redirect! assert_response :success - assert_template "todo/index" + assert_template "todos/index" end end diff --git a/tracks/test/selenium/tickler/see_all_deferred.rsel b/tracks/test/selenium/tickler/see_all_deferred.rsel new file mode 100644 index 00000000..27fd4648 --- /dev/null +++ b/tracks/test/selenium/tickler/see_all_deferred.rsel @@ -0,0 +1,4 @@ +setup :fixtures => :all +include_partial 'login/login', :username => 'admin', :password => 'abracadabra' +open "/tickler/" +assert_element_present "todo_15"