Module: GestartAdmino::ActionViewExtension

Defined in:
lib/gestart_admino/action_view_extension.rb

Defined Under Namespace

Modules: Internals

Instance Method Summary collapse

Instance Method Details

#simple_search_form_for(query, options = {}, &block) ⇒ Object



28
29
30
31
32
# File 'lib/gestart_admino/action_view_extension.rb', line 28

def simple_search_form_for(query, options = {}, &block)
  options.symbolize_keys!
  Internals.present_query(query, self, options.slice(:presenter)).
    simple_form(options, &block)
end

#table_for(collection, options = {}, &block) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/gestart_admino/action_view_extension.rb', line 14

def table_for(collection, options = {}, &block)
  options.symbolize_keys!
  options.assert_valid_keys(:presenter, :class, :query, :html)
  presenter_klass = options.fetch(:presenter, GestartAdmino::Table::Presenter)
  query = if options[:query]
            Internals.present_query(options[:query], self, options, :query_presenter)
          else
            nil
          end
  presenter = presenter_klass.new(collection, options[:class], query, self)
  html_options = options.fetch(:html, {})
  presenter.to_html(html_options, &block)
end