Sha256: bc45067c3afb9cd0269ee8828f5834ec55d99a43bcd49c0ba976eade9e219ca3

Contents?: true

Size: 835 Bytes

Versions: 12

Compression:

Stored size: 835 Bytes

Contents

# encoding: utf-8
class CsvExportController < ApplicationController
  def index
    @tasks_grid = initialize_grid(Task,
      include: [:priority, :status, :project, :assigned_users],
      order: 'statuses.name',
      custom_order: {
        'tasks.priority_id' => 'priorities.name',
        'tasks.status_id' => 'statuses.position',
        'tasks.project_id' => 'projects.name'
      },
      name: 'g1',
      enable_export_to_csv: true,
      csv_field_separator: ';',
      csv_file_name: 'tasks'
    )

    @projects_grid = initialize_grid(Project,
      name: 'g2',
      enable_export_to_csv: true,
      csv_file_name: 'projects'
    )

    export_grid_if_requested('g1' => 'tasks_grid', 'g2' => 'projects_grid') do
      # usual render or redirect code executed if the request is not a CSV export request
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
wice_grid-6.1.3 spec/support/test_app/app/controllers/csv_export_controller.rb
wice_grid-6.1.2 spec/support/test_app/app/controllers/csv_export_controller.rb
wice_grid-6.1.1 spec/support/test_app/app/controllers/csv_export_controller.rb
wice_grid-6.1.0 spec/support/test_app/app/controllers/csv_export_controller.rb
pwice_grid-7.0.0 spec/support/test_app/app/controllers/csv_export_controller.rb
pwice_grid-6.1.2 spec/support/test_app/app/controllers/csv_export_controller.rb
pwice_grid-6.1.1 spec/support/test_app/app/controllers/csv_export_controller.rb
pwice_grid-6.1.0 spec/support/test_app/app/controllers/csv_export_controller.rb
pwice_grid-5.0.2 spec/support/test_app/app/controllers/csv_export_controller.rb
pwice_grid-5.0.1 spec/support/test_app/app/controllers/csv_export_controller.rb
pwice_grid-5.0.0 spec/support/test_app/app/controllers/csv_export_controller.rb
wice_grid-4.1.0 spec/support/test_app/app/controllers/csv_export_controller.rb