Class: Avo::Fields::PreviewField::IndexComponent

Inherits:
IndexComponent show all
Defined in:
app/components/avo/fields/preview_field/index_component.rb

Constant Summary

Constants included from Concerns::FindAssociationField

Concerns::FindAssociationField::ASSOCIATIONS

Instance Attribute Summary

Attributes inherited from IndexComponent

#field, #kwargs, #parent_resource, #view

Instance Method Summary collapse

Methods inherited from IndexComponent

#field_wrapper_args, #initialize, #resource_view_path

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 inherited from BaseComponent

#component_name, #has_with_trial

Methods included from Concerns::FindAssociationField

#find_association_field

Constructor Details

This class inherits a constructor from Avo::Fields::IndexComponent

Instance Method Details

#render_previewObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/components/avo/fields/preview_field/index_component.rb', line 4

def render_preview
  link_to resource_view_path, title: t("avo.view_item", item: @resource.name).humanize do
    helpers.svg(
      "heroicons/outline/magnifying-glass-circle",
      class: "block h-6 text-gray-600",
      data: {
        controller: "preview",
        preview_url_value: helpers.preview_resource_path(resource: @resource, turbo_frame: :preview_modal),
      }
    )
  end
end