module Admino::ActionViewExtension

Public Instance Methods

filters_for(query, options = {}, &block) click to toggle source
# File lib/admino/action_view_extension.rb, line 28
def filters_for(query, options = {}, &block)
  options.symbolize_keys!
  options.assert_valid_keys(:presenter)
  Internals.present_query(query, self, options).filter_groups.each(&block)
end
search_form_for(query, options = {}, &block) click to toggle source
# File lib/admino/action_view_extension.rb, line 40
def search_form_for(query, options = {}, &block)
  options.symbolize_keys!
  Internals.present_query(query, self, options.slice(:presenter)).
    form(options, &block)
end
simple_search_form_for(query, options = {}, &block) click to toggle source
# File lib/admino/action_view_extension.rb, line 46
def simple_search_form_for(query, options = {}, &block)
  options.symbolize_keys!
  Internals.present_query(query, self, options.slice(:presenter)).
    simple_form(options, &block)
end
sortings_for(query, options = {}, &block) click to toggle source
# File lib/admino/action_view_extension.rb, line 34
def sortings_for(query, options = {}, &block)
  options.symbolize_keys!
  options.assert_valid_keys(:presenter)
  Internals.present_query(query, self, options).sorting.scopes.each(&block)
end
table_for(collection, options = {}, &block) click to toggle source
# File lib/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, Admino::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