Module: ActiveAdmin::Resource::PagePresenters
- Included in:
- Page, ActiveAdmin::Resource
- Defined in:
- lib/active_admin/resource/page_presenters.rb
Instance Method Summary collapse
-
#default_index_class ⇒ Object
for setting default css class in admin ui.
-
#get_page_presenter(action, type = nil) ⇒ PagePresenter?
Returns a stored page config.
-
#page_presenters ⇒ Object
A hash of page configurations for the controller indexed by action name.
-
#set_page_presenter(action, page_presenter) ⇒ Object
Sets a page config for a given action.
Instance Method Details
#default_index_class ⇒ Object
for setting default css class in admin ui
7 8 9 |
# File 'lib/active_admin/resource/page_presenters.rb', line 7 def default_index_class @default_index end |
#get_page_presenter(action, type = nil) ⇒ PagePresenter?
Returns a stored page config
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/active_admin/resource/page_presenters.rb', line 37 def get_page_presenter(action, type = nil) if action.to_s == "index" && type && page_presenters[:index].kind_of?(Hash) page_presenters[:index][type.to_sym] elsif action.to_s == "index" && page_presenters[:index].kind_of?(Hash) page_presenters[:index].default else page_presenters[action.to_sym] end end |
#page_presenters ⇒ Object
A hash of page configurations for the controller indexed by action name
12 13 14 |
# File 'lib/active_admin/resource/page_presenters.rb', line 12 def page_presenters @page_presenters ||= {} end |
#set_page_presenter(action, page_presenter) ⇒ Object
Sets a page config for a given action
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/active_admin/resource/page_presenters.rb', line 20 def set_page_presenter(action, page_presenter) if action.to_s == "index" && page_presenter[:as] index_class = find_index_class(page_presenter[:as]) page_presenter_key = index_class.index_name.to_sym set_index_presenter page_presenter_key, page_presenter else page_presenters[action.to_sym] = page_presenter end end |