Sha256: e7177e3cdc9c07ec51042b5f251237a7047add4d488a0c0d23f8c574a6490605

Contents?: true

Size: 660 Bytes

Versions: 2

Compression:

Stored size: 660 Bytes

Contents

require 'showcase'

module Admino
  module Query
    class BasePresenter < Showcase::Presenter
      presents_collection :groups
      presents :sorting

      def form(options = {}, &block)
        h.form_for(
          self,
          options.reverse_merge(default_form_options),
          &block
        )
      end

      def simple_form(options = {}, &block)
        h.simple_form_for(
          self,
          options.reverse_merge(default_form_options),
          &block
        )
      end

      def default_form_options
        {
          as: :query,
          method: :get,
          url: h.request.fullpath
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
admino-0.0.3 lib/admino/query/base_presenter.rb
admino-0.0.2 lib/admino/query/base_presenter.rb