Class: Avo::ActionsComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Avo::ActionsComponent
- Includes:
- ApplicationHelper
- Defined in:
- app/components/avo/actions_component.rb
Constant Summary collapse
- ACTION_FILTER =
_Set(_Class(Avo::BaseAction))
Constants included from Concerns::FindAssociationField
Concerns::FindAssociationField::ASSOCIATIONS
Instance Method Summary collapse
- #after_initialize ⇒ Object
- #filter_actions ⇒ Object
-
#is_disabled?(action) ⇒ Boolean
How should the action be displayed by default.
- #render? ⇒ Boolean
Methods included from ApplicationHelper
#a_button, #a_link, #button_classes, #card_classes, #chart_color, #decode_filter_params, #empty_state, #encode_filter_params, #frame_id, #get_model_class, #input_classes, #mount_path, #number_to_social, #render_license_warning, #root_path_without_url, #svg, #white_panel_classes
Methods included from ResourcesHelper
#field_wrapper, #filter_wrapper, #index_field_wrapper, #item_selector_data_attributes, #resource_grid, #resource_show_path, #resource_table
Methods inherited from BaseComponent
Methods included from Concerns::FindAssociationField
Instance Method Details
#after_initialize ⇒ Object
37 38 39 |
# File 'app/components/avo/actions_component.rb', line 37 def after_initialize filter_actions unless @custom_list end |
#filter_actions ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/components/avo/actions_component.rb', line 45 def filter_actions @actions = @actions.dup if @exclude.any? @actions.reject! { |action| @exclude.include?(action.class) } end if @include.any? @actions.select! { |action| @include.include?(action.class) } end end |
#is_disabled?(action) ⇒ Boolean
How should the action be displayed by default
58 59 60 61 62 |
# File 'app/components/avo/actions_component.rb', line 58 def is_disabled?(action) return false if action.standalone || @as_row_control on_index_page? end |
#render? ⇒ Boolean
41 42 43 |
# File 'app/components/avo/actions_component.rb', line 41 def render? @actions.present? end |