Sha256: 84724eb71a89170ab49e0b21c345eb9738cf4ccdc51eafb4877972f00b792274

Contents?: true

Size: 1020 Bytes

Versions: 5

Compression:

Stored size: 1020 Bytes

Contents

module RailsAdmin
  module Config
    module Actions
      class Export < RailsAdmin::Config::Actions::Base
        RailsAdmin::Config::Actions.register(self)

        register_instance_option :collection do
          true
        end

        register_instance_option :http_methods do
          [:get, :post]
        end

        register_instance_option :controller do
          proc do

            if format = params[:json] && :json || params[:csv] && :csv || params[:xml] && :xml
              request.format = format
              @schema = params[:schema].symbolize if params[:schema] # to_json and to_xml expect symbols for keys AND values.
              @objects = list_entries(@model_config, :export)
              index
            else
              render @action.template_name
            end

          end
        end

        register_instance_option :bulkable? do
          true
        end

        register_instance_option :link_icon do
          'icon-share'
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_admin-0.6.5 lib/rails_admin/config/actions/export.rb
rails_admin-0.6.4 lib/rails_admin/config/actions/export.rb
rails_admin-0.6.3 lib/rails_admin/config/actions/export.rb
rails_admin-0.6.2 lib/rails_admin/config/actions/export.rb
rails_admin-0.6.1 lib/rails_admin/config/actions/export.rb