Module: Admino::ActionViewExtension
- Defined in:
- lib/admino/action_view_extension.rb
Defined Under Namespace
Modules: Internals
Instance Method Summary collapse
- #filters_for(query, options = {}, &block) ⇒ Object
- #search_form_for(query, options = {}, &block) ⇒ Object
- #simple_search_form_for(query, options = {}, &block) ⇒ Object
- #sortings_for(query, options = {}, &block) ⇒ Object
- #table_for(collection, options = {}, &block) ⇒ Object
Instance Method Details
#filters_for(query, options = {}, &block) ⇒ Object
28 29 30 31 32 |
# File 'lib/admino/action_view_extension.rb', line 28 def filters_for(query, = {}, &block) .symbolize_keys! .assert_valid_keys(:presenter) Internals.present_query(query, self, ).filter_groups.each(&block) end |
#search_form_for(query, options = {}, &block) ⇒ Object
40 41 42 43 44 |
# File 'lib/admino/action_view_extension.rb', line 40 def search_form_for(query, = {}, &block) .symbolize_keys! Internals.present_query(query, self, .slice(:presenter)). form(, &block) end |
#simple_search_form_for(query, options = {}, &block) ⇒ Object
46 47 48 49 50 |
# File 'lib/admino/action_view_extension.rb', line 46 def simple_search_form_for(query, = {}, &block) .symbolize_keys! Internals.present_query(query, self, .slice(:presenter)). simple_form(, &block) end |
#sortings_for(query, options = {}, &block) ⇒ Object
34 35 36 37 38 |
# File 'lib/admino/action_view_extension.rb', line 34 def sortings_for(query, = {}, &block) .symbolize_keys! .assert_valid_keys(:presenter) Internals.present_query(query, self, ).sorting.scopes.each(&block) end |
#table_for(collection, options = {}, &block) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/admino/action_view_extension.rb', line 14 def table_for(collection, = {}, &block) .symbolize_keys! .assert_valid_keys(:presenter, :class, :query, :html) presenter_klass = .fetch(:presenter, Admino::Table::Presenter) query = if [:query] Internals.present_query([:query], self, , :query_presenter) else nil end presenter = presenter_klass.new(collection, [:class], query, self) = .fetch(:html, {}) presenter.to_html(, &block) end |