Class: Avo::Fields::CheckboxListField::ItemComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/avo/fields/checkbox_list_field/item_component.rb

Constant Summary

Constants included from Concerns::FindAssociationField

Concerns::FindAssociationField::ASSOCIATIONS

Instance Method Summary collapse

Methods inherited from BaseComponent

#component_name, #hotkey_badge

Methods included from ApplicationHelper

#a_button, #a_link, #body_classes, #button_classes, #chart_color, #container_classes, #d, #decode_filter_params, #e, #editor_file_path, #editor_url, #empty_state, #encode_filter_params, #frame_id, #get_model_class, #input_classes, #manual_frame_cookie_name, #manual_frame_remembered?, #mount_path, #number_to_social, #possibly_rails_authentication?, #render_header_menu_items, #render_license_warning, #root_path_without_url, #rtl?, #safe_blob_path, #safe_blob_representation_url, #safe_blob_url, #text_direction, #ui, #wrap_in_modal

Methods included from SummaryChartHelper

#summary_chart_params_for

Methods included from ResourcesHelper

#field_wrapper, #filter_wrapper, #index_field_wrapper, #item_selector_data_attributes, #record_path, #record_title, #resource_for_record, #resource_grid, #resource_show_path, #resource_table

Methods included from Concerns::FindAssociationField

#find_association_field

Instance Method Details

#alt_textObject



35
36
37
# File 'app/components/avo/fields/checkbox_list_field/item_component.rb', line 35

def alt_text
  @image_alt || @title
end

#image_classObject



25
26
27
28
29
30
31
32
33
# File 'app/components/avo/fields/checkbox_list_field/item_component.rb', line 25

def image_class
  rounding = case @image_format&.to_sym
  when :rounded then "rounded-sm"
  when :square then "rounded-none"
  else "rounded-full"
  end

  class_names("search-item-image", rounding)
end

#row_dataObject



18
19
20
21
22
23
# File 'app/components/avo/fields/checkbox_list_field/item_component.rb', line 18

def row_data
  {
    "checkbox-list-field-target": "row",
    "checkbox-list-field-search-text": search_text
  }
end

#search_textObject



39
40
41
# File 'app/components/avo/fields/checkbox_list_field/item_component.rb', line 39

def search_text
  [@title, @description].compact.join(" ")
end