form_selector = "#{element_form_id(:action => :batch_create)}" if controller.send :batch_successful? called_by_controller = params.delete(:batch_create_by) if called_by_controller.nil? page.call 'ActiveScaffold.replace_html', active_scaffold_content_id, render(:partial => 'list', :layout => false) else options = {:checked => false, :include_mark_all => false} tbody_id = "#{controller_id(called_by_controller)}-tbody" page << "ActiveScaffold.mark_records('#{tbody_id}', #{options.to_json});" end page << "ActiveScaffold.find_action_link('#{form_selector}').close();" else page << "ActiveScaffold.find_action_link('#{form_selector}').update_flash_messages('#{escape_javascript(render(:partial => 'messages').strip)}');" page.call 'ActiveScaffold.replace', form_selector, render(:partial => 'batch_create_form', :locals => {:xhr => true}) page.call 'ActiveScaffold.scroll_to', form_selector #have to uncheck successfully created marked_records end