Module: ActiveScaffold::Actions::ExportTool

Includes:
PrintBase
Defined in:
lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/export_tool.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Search

#reset_search, #reset_search_session_info, #search_session_info, #store_params_into_search_session_info

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/export_tool.rb', line 4

def self.included(base)
  base.before_filter :export_tool_authorized_filter, :only => [:export_tool]
end

Instance Method Details

#export_toolObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/export_tool.rb', line 23

def export_tool
  do_print_list(active_scaffold_config.export_tool)
  active_scaffold_config.export_tool.delimiter = params[:delimiter]
  # fastercsv doesn't work with a nil delimiter
  active_scaffold_config.export_tool.delimiter = ',' if active_scaffold_config.export_tool.delimiter.empty?
  active_scaffold_config.export_tool.skip_header = params[:skip_header]
  response.headers['Cache-Control'] = 'max-age=60' # IE 6 needs this!
  response.headers['Content-Disposition'] = "attachment; filename=\"#{self.controller_name}.csv\""
  render :partial => 'export_csv', :content_type => Mime::CSV, :status => response_status 
end

#show_export_toolObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/actions/export_tool.rb', line 8

def show_export_tool
  respond_to do |wants|
    wants.html do
      if successful?
        render(:partial => 'show_export_tool', :layout => true)
      else
        return_to_main
      end
    end
    wants.js do
      render(:partial => 'show_export_tool', :layout => false)
    end
  end
end