tracks/tracks/app/views/todo/toggle_check.rjs
lukemelia c51587e422 * Converted Todo to acts_as_state_machine. It's states are active, deferred, completed, and project_hidden. This replaces the old single inheritance model of Immediate and Deferred. Also renamed todo.completed to todo.completed_at for clarity
* Consolidated toggle_check handling to todo_controller and rjs  
* Introduced user preference to show/hide hidden projects section in sidebar
* Fixed a bug in parse_date_per_user_prefs that was causing due dates to be set in the todo model as Times and not Dates
* Upgraded ARTS plugin
* This changeset includes migrations, so remember to db:migrate.
* Lots of code changes here, so bug reports will be gratefully accepted!



git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@343 a4c988fc-2ded-0310-b66e-134b36920a42
2006-11-15 09:05:07 +00:00

36 lines
No EOL
2 KiB
Text

if @saved
item_container_id = "c#{@item.context_id}"
parent_container_type = "context"
if source_view_is :context
empty_container_msg_div_id = "c#{@item.context_id}empty-nd"
elsif source_view_is :project
item_container_id = "p#{@item.project_id}"
empty_container_msg_div_id = "p#{@item.project_id}empty-nd"
parent_container_type = "project"
end
page.remove "item-#{@item.id}-container"
if @item.completed?
# Don't try to insert contents into a non-existent container!
unless @user.preference.hide_completed_actions?
page.insert_html :top, "completed", :partial => 'todo/item', :locals => { :parent_container_type => "completed" }
page.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
page[empty_container_msg_div_id].show if @down_count == '0' && !empty_container_msg_div_id.nil?
page.hide "empty-d" # If we've checked something as done, completed items can't be empty
end
if @remaining_undone_in_context == 0 && source_view_is(:todo)
page.visual_effect :fade, item_container_id, :duration => 0.4
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.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
page.show "empty-d" if @done_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
end
page.hide "status"
page.replace_html "badge_count", @down_count
else
page.replace_html "status", content_tag("div", content_tag("h2", "#{pluralize(@item.errors.count, "error")} prohibited this record from being saved") + content_tag("p", "There were problems with the following fields:") + content_tag("ul", @item.errors.each_full { |msg| content_tag("li", msg) }), "id" => "ErrorExplanation", "class" => "ErrorExplanation")
end