if @saved page.hide 'multiple_status' status_message = t('todos.added_new_next_action') status_message += 's' if @todos.size > 1 status_message = t('todos.added_new_project') + ' / ' + status_message if @new_project_created status_message = t('todos.added_new_context') + ' / ' + status_message if @new_context_created page.notify :notice, status_message, 5.0 page['badge_count'].replace_html @down_count # reset form and set focus to first field page.send :record, "$('#todo-form-multi-new-action').clearForm();$('#todo-form-multi-new-action input:text:first').focus();" # set defaults of form page.send :record, "$('#multi_todo_context_name').val('#{@initial_context_name}');" page.send :record, "$('#multi_todo_project_name').val('#{@initial_project_name}');" page.send :record, "$('#multi_tag_list').val('#{@default_tags}');" if should_show_new_item() if @new_context_created page.insert_html :top, 'display_box', :partial => 'contexts/context', :locals => { :context => @todo.context, :collapsible => true } else page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@todo.context_id}" if source_view_is_one_of(:todo, :deferred, :tag) @todos.each do |todo| page.insert_html :bottom, item_container_id(todo), :partial => 'todos/todo', :locals => { :todo => todo, :parent_container_type => parent_container_type, :source_view => @source_view } page.visual_effect :highlight, dom_id(todo), :duration => 3 end page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil? end if (source_view_is :project and @todo.pending?) or (source_view_is :deferred) page['tickler-empty-nd'].hide # For some reason this does not work: page['tickler-empty-nd'].hide if (@todo.pending? or (source_view_is :deferred)) end end # make sure the behavior of the new/updated todo is enabled page << "enable_rich_interaction();" else page.show 'multiple_status' # add error about missing todo description that is not available in @todos @multiple_error = content_tag(:div, content_tag(:p, @multiple_error), {:class => 'errorExplanation', :id => 'errorExplanation'}) unless @multiple_error.blank? error_messages = @multiple_error || "" # add errors of individual @todos @todos.each do |todo| @todo_i = todo error_messages += error_messages_for('todo_i', :object_name => 'action') end page.replace_html 'multiple_status', error_messages end