Module: AbAdmin::Views::ManagerHelpers
- Defined in:
- lib/ab_admin/views/manager_helpers.rb
Constant Summary collapse
- INDEX_VIEW_ICONS =
{table: 'list', tree: 'move', grid: 'th'}
Instance Method Summary collapse
- #action_item_admin_path(name, record = nil) ⇒ Object
- #form_builder ⇒ Object
- #index_view_link(index_view) ⇒ Object
- #modal_form_builder ⇒ Object
- #search_builder ⇒ Object
- #show_builder ⇒ Object
- #table_builder ⇒ Object
Instance Method Details
#action_item_admin_path(name, record = nil) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/ab_admin/views/manager_helpers.rb', line 27 def action_item_admin_path(name, record=nil) custom_action = manager.custom_action_for(name, self) if custom_action.collection? admin_collection_action_path(model_name: resource_collection_name, custom_action: custom_action.name) else record ||= resource admin_member_action_path(model_name: resource_collection_name, id: record.id, custom_action: custom_action.name) end end |
#form_builder ⇒ Object
15 16 17 |
# File 'lib/ab_admin/views/manager_helpers.rb', line 15 def form_builder manager.form ||= ::AbAdmin::Config::Form.default_for_model(resource_class, skip: [:id, :created_at, :updated_at, :lft, :rgt, :depth]) end |
#index_view_link(index_view) ⇒ Object
37 38 39 40 41 |
# File 'lib/ab_admin/views/manager_helpers.rb', line 37 def index_view_link(index_view) = {class: "btn #{('active' if current_index_view == index_view)}", title: t("admin.index_view.#{index_view}")} url = url_for(index_view: index_view) link_to icon(INDEX_VIEW_ICONS[index_view.to_sym]), url, end |
#modal_form_builder ⇒ Object
19 20 21 |
# File 'lib/ab_admin/views/manager_helpers.rb', line 19 def modal_form_builder manager.modal_form ||= ::AbAdmin::Config::ModalForm.default_for_model(resource_class, skip: [:id, :created_at, :updated_at, :lft, :rgt, :depth]) end |
#search_builder ⇒ Object
11 12 13 |
# File 'lib/ab_admin/views/manager_helpers.rb', line 11 def search_builder manager.search ||= ::AbAdmin::Config::Search.default_for_model(resource_class) end |
#show_builder ⇒ Object
23 24 25 |
# File 'lib/ab_admin/views/manager_helpers.rb', line 23 def show_builder manager.show ||= ::AbAdmin::Config::Show.default_for_model(resource_class) end |
#table_builder ⇒ Object
7 8 9 |
# File 'lib/ab_admin/views/manager_helpers.rb', line 7 def table_builder manager.table ||= ::AbAdmin::Config::Table.default_for_model(resource_class) end |