Sha256: 9dcd0faac65cfb469808cdaae02c2a3049fcdd455abb2b2cfcd67dfc02a3bfe0
Contents?: true
Size: 939 Bytes
Versions: 12
Compression:
Stored size: 939 Bytes
Contents
# frozen_string_literal: true class Avo::Index::GridItemComponent < Avo::BaseComponent include Avo::ResourcesHelper attr_reader :parent_resource, :actions def initialize(resource: nil, reflection: nil, parent_record: nil, parent_resource: nil, actions: nil) @resource = resource @reflection = reflection @grid_fields = resource.get_grid_fields @parent_record = parent_record @parent_resource = parent_resource @actions = actions end private def cover @grid_fields.cover_field end def title @grid_fields.title_field end def body @grid_fields.body_field end def resource_view_path args = {} if @parent_record.present? args = { via_resource_class: parent_resource.class.to_s, via_record_id: @parent_record.to_param } end helpers.resource_view_path(record: @resource.record, resource: parent_or_child_resource, **args) end end
Version data entries
12 entries across 12 versions & 1 rubygems