Sha256: 380642b0fdd2aab769aeddedcd94ca13da580d007079339cd7d5d7866721d90e

Contents?: true

Size: 921 Bytes

Versions: 6

Compression:

Stored size: 921 Bytes

Contents

module Listings
  class ListingsController < ActionController::Base
    include ActionViewExtensions

    def full
      @listing = prepare_listing params, view_context
      render 'listings/full'
    ensure
      Kaminari::Helpers::Tag.paginate_with_listings(nil)
    end

    def content
      @listing = prepare_listing params, view_context
      render 'listings/content'
    ensure
      Kaminari::Helpers::Tag.paginate_with_listings(nil)
    end

    def export
      @listing = prepare_listing params, view_context, false

      respond_to do |format|
        format.csv { send_data @listing.to_csv, filename: @listing.export_filename(:csv) }
        format.xls do
          headers["Content-Disposition"] = "attachment; filename=\"#{@listing.export_filename(:xls)}\""
          render 'listings/export'
        end
      end
    ensure
      Kaminari::Helpers::Tag.paginate_with_listings(nil)
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
listings-0.1.13 app/controllers/listings/listings_controller.rb
listings-0.1.12 app/controllers/listings/listings_controller.rb
listings-0.1.11 app/controllers/listings/listings_controller.rb
listings-0.1.10 app/controllers/listings/listings_controller.rb
listings-0.1.8 app/controllers/listings/listings_controller.rb
listings-0.1.7 app/controllers/listings/listings_controller.rb