Sha256: b0807b131677df657ef2a276997f7c8c0b1139bcafccaed92d27aecb8c33dc74

Contents?: true

Size: 841 Bytes

Versions: 5

Compression:

Stored size: 841 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'
    )

    return 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

5 entries across 5 versions & 1 rubygems

Version Path
wice_grid-7.1.4 spec/support/test_app/app/controllers/csv_export_controller.rb
wice_grid-7.1.3 spec/support/test_app/app/controllers/csv_export_controller.rb
wice_grid-7.1.2 spec/support/test_app/app/controllers/csv_export_controller.rb
wice_grid-7.1.1 spec/support/test_app/app/controllers/csv_export_controller.rb
wice_grid-7.1.0 spec/support/test_app/app/controllers/csv_export_controller.rb