tracks/tracks/app/views/project/toggle_check.rjs

26 lines
No EOL
1.5 KiB
Text

if @saved
page.remove "item-#{@item.id}-container"
if @item.done?
# Don't try to insert contents into a non-existent container!
unless @user.preferences["no_completed"].to_i == 0
page.insert_html :top, "completed", :partial => 'todo/item', :locals => { :parent_container_type => "project" }
page.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
if @down_count == '0'
page["p#{@item.project_id}empty-nd"].show
end
page.hide "empty-d" # If we've checked something as done, completed items can't be empty
end
else
page.call "todoItems.ensureVisibleWithEffectAppear", "p#{@item.project_id}"
page.insert_html :bottom, "p#{@item.project_id}", :partial => 'todo/item', :locals => { :parent_container_type => "project" }
page.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
if @done_count == '0'
page.show "empty-d"
end
page["p#{@item.project_id}empty-nd"].hide # 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