Sha256: 118c09e6993a9113699e4e630db138b8a328535c6558acb013cf53df6e3e24b3

Contents?: true

Size: 810 Bytes

Versions: 5

Compression:

Stored size: 810 Bytes

Contents

class Admin::VersionsController < Admin::BaseController
  load_and_authorize_resource param_method: :strong_params, class: 'PaperTrail::Version'

  respond_to :xlsx

  resource PaperTrail::Version,
                    location: proc { params[:stay_in_place] ?
                                  edit_polymorphic_path([:admin, resource]) :
                                  polymorphic_path([:admin, resource.class]) }

  def index
    @versions = PaperTrail::Version.all

    respond_with do |respond|
      respond.xlsx do
        xlsx_file = ExportXlsx.new.call
        send_data xlsx_file
      end
    end
  end

  private

  alias_method :collection_orig, :collection
  def collection
    @collection ||= collection_orig.order('created_at desc')
      .page(params[:page]).per(settings.per_page)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
adminos-1.0.0.pre.rc.5 lib/generators/templates/install/admin_panel/versions/admin_versions_controller.rb
adminos-1.0.0.pre.rc.4 lib/generators/templates/install/admin_panel/versions/admin_versions_controller.rb
adminos-1.0.0.pre.rc.3 lib/generators/templates/install/admin_panel/versions/admin_versions_controller.rb
adminos-1.0.0.pre.rc.2 lib/generators/templates/install/admin_panel/versions/admin_versions_controller.rb
adminos-1.0.0.pre.rc.1 lib/generators/templates/install/admin_panel/versions/admin_versions_controller.rb