diff --git a/tracks/app/controllers/context_controller.rb b/tracks/app/controllers/context_controller.rb index 7e1abd2d..8956919e 100644 --- a/tracks/app/controllers/context_controller.rb +++ b/tracks/app/controllers/context_controller.rb @@ -72,36 +72,15 @@ class ContextController < ApplicationController end end - # Methods for changing the sort order of the contexts in the list + # Methods for changing the sort order of the projects in the list # - def move_up - check_user_set_context - @context.move_higher - @context.save - redirect_to(:controller => "context", :action => "list") + def order + @params["list-contexts"].each_with_index do |id, position| + Context.update(id, :position => position + 1) + end + render_text "" end - - def move_down - check_user_set_context - @context.move_lower - @context.save - redirect_to(:controller => "context", :action => "list") - end - - def move_top - check_user_set_context - @context.move_to_top - @context.save - redirect_to(:controller => "context", :action => "list") - end - - def move_bottom - check_user_set_context - @context.move_to_bottom - @context.save - redirect_to(:controller => "context", :action => "list" ) - end - + protected def check_user_set_context diff --git a/tracks/app/controllers/project_controller.rb b/tracks/app/controllers/project_controller.rb index c04d2c97..8e5f9174 100644 --- a/tracks/app/controllers/project_controller.rb +++ b/tracks/app/controllers/project_controller.rb @@ -71,34 +71,13 @@ class ProjectController < ApplicationController # Methods for changing the sort order of the projects in the list # - def move_up - check_user_set_project - @project.move_higher - @project.save - redirect_to(:controller => "project", :action => "list") + def order + @params["list-projects"].each_with_index do |id, position| + Project.update(id, :position => position + 1) + end + render_text "" end - - def move_down - check_user_set_project - @project.move_lower - @project.save - redirect_to(:controller => "project", :action => "list") - end - - def move_top - check_user_set_project - @project.move_to_top - @project.save - redirect_to(:controller => "project", :action => "list") - end - - def move_bottom - check_user_set_project - @project.move_to_bottom - @project.save - redirect_to(:controller => "project", :action => "list" ) - end - + protected def check_user_set_project @@ -118,8 +97,7 @@ class ProjectController < ApplicationController render_text "" end end - - + def init @user = @session['user'] @projects = @user.projects diff --git a/tracks/app/helpers/application_helper.rb b/tracks/app/helpers/application_helper.rb index 2f27d0ff..018eb0b1 100644 --- a/tracks/app/helpers/application_helper.rb +++ b/tracks/app/helpers/application_helper.rb @@ -51,7 +51,7 @@ module ApplicationHelper when 0 "Due Today " when 1 - "Due Tommorrow " + "Due Tomorrow " # due 2-7 days away when 2..7 "Due in " + @days.to_s + " days " diff --git a/tracks/app/helpers/todo_helper.rb b/tracks/app/helpers/todo_helper.rb index c96e3466..0b4096b8 100644 --- a/tracks/app/helpers/todo_helper.rb +++ b/tracks/app/helpers/todo_helper.rb @@ -12,7 +12,7 @@ module TodoHelper :update => "completed", :position => "top", :loading => "Form.disable('checkbox-notdone-#{item.id}');", - :complete => "new Effect2.Fade('item-#{item.id}-container', true);" + :complete => visual_effect(:fade, "item-#{item.id}-container") ) end @@ -22,7 +22,7 @@ module TodoHelper :update => "new_actions", :position => "bottom", :loading => "Form.disable('checkbox-done-#{item.id}');", - :complete => "Element.toggle('new_actions');new Effect2.Fade('done-item-#{item.id}-container', true);" + :complete => "Element.toggle('new_actions');new Effect.Fade('done-item-#{item.id}-container');" ) end @@ -30,7 +30,7 @@ module TodoHelper form_remote_tag( :url => { :controller => 'todo', :action => 'update_action', :id => item.id }, :html => { :id => "form-action-#{item.id}", :class => "inline-form" }, :update => "item-#{item.id}-container", - :complete => "new Effect.Appear('item-#{item.id}-container');" + :complete => visual_effect(:appear, "item-#{item.id}-container") ) end @@ -40,7 +40,7 @@ module TodoHelper str << " Form.focusFirstElement('form-action-#{item.id}')" link_to_remote( image_tag("blank", :title =>"Delete action", :class=>"delete_item"), :update => "item-#{item.id}-container", - :loading => "new Effect2.Fade('item-#{item.id}-container', true)", + :loading => visual_effect(:fade, "item-#{item.id}-container"), :url => { :controller => "todo", :action => "destroy_action", :id => item.id }, :confirm => "Are you sure that you want to delete the action, \'#{item.description}\'?") + " " + link_to_function(image_tag( "blank", :title => "Edit action", :class => "edit_item"), @@ -50,7 +50,7 @@ module TodoHelper def link_to_remote_todo_done( item ) link_to_remote( image_tag("blank", :title =>"Delete action", :class=>"delete_item"), :update => "done-item-#{item.id}-container", - :loading => "new Effect2.Fade('done-item-#{item.id}-container', true)", + :loading => visual_effect(:fade, "done-item-#{item.id}-container"), :url => { :controller => "todo", :action => "destroy_action", :id => item.id }, :confirm => "Are you sure that you want to delete the action \'#{item.description}\'?" ) + "" + image_tag("blank") + " " diff --git a/tracks/app/views/context/_context_listing.rhtml b/tracks/app/views/context/_context_listing.rhtml index 82863e6c..2ddcbeab 100644 --- a/tracks/app/views/context/_context_listing.rhtml +++ b/tracks/app/views/context/_context_listing.rhtml @@ -1,21 +1,10 @@ <% context = context_listing %> -