tracks/app/views/recurring_todos/toggle_check.js.rjs
2008-07-19 20:27:45 +02:00

30 lines
No EOL
1.2 KiB
Text

if @saved
page[@recurring_todo].remove
page['badge_count'].replace_html @count
if @recurring_todo.completed?
# show completed recurring todo
page.insert_html :top, "completed_recurring_todos_container", :partial => 'recurring_todos/recurring_todo'
page.visual_effect :highlight, dom_id(@recurring_todo), :duration => 3
# set empty messages
page.show 'recurring-todos-empty-nd' if @remaining == 0
page.hide 'completed-empty-nd'
else
# recurring_todo is activated
# show completed recurring todo
page.insert_html :top, "recurring_todos_container", :partial => 'recurring_todos/recurring_todo'
page.visual_effect :highlight, dom_id(@recurring_todo), :duration => 3
# inform user if a new todo has been created because of the activation
page.notify :notice, "A new todo was added which belongs to this recurring todo", 3.0 unless @new_recurring_todo.nil?
# set empty messages
page.show 'completed-empty-nd' if @remaining == 0
page.hide 'recurring-todos-empty-nd'
end
else
page.notify :error, "There was an error completing / activating the recurring todo #{@recurring_todo.description}", 8.0
end