Sha256: 016b51bd9690508d95b95d575bc7e4b3494fabcf133e7e814e343548280edf62

Contents?: true

Size: 605 Bytes

Versions: 87

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true

class Avo::Fields::TrixField::EditComponent < Avo::Fields::EditComponent
  attr_reader :resource

  def initialize(**args)
    @resource = args[:resource]
    @resource_id = args[:resource_id]
    @resource_name = args[:resource_name]

    super(**args)
  end

  def resource_name
    @resource_name || resource&.singular_route_key
  end

  def resource_id
    @resource_id || resource&.record&.id
  end

  def trix_id
    if resource_name.present?
      "trix_#{resource_name}_#{@field.id}"
    elsif form.present?
      "trix_#{form.index}_#{@field.id}"
    end
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
avo-3.6.1 app/components/avo/fields/trix_field/edit_component.rb
avo-3.6.0 app/components/avo/fields/trix_field/edit_component.rb
avo-3.5.8 app/components/avo/fields/trix_field/edit_component.rb
avo-3.5.7 app/components/avo/fields/trix_field/edit_component.rb
avo-3.5.6 app/components/avo/fields/trix_field/edit_component.rb
avo-3.5.6.beta1 app/components/avo/fields/trix_field/edit_component.rb
avo-3.5.5 app/components/avo/fields/trix_field/edit_component.rb
avo-3.5.4 app/components/avo/fields/trix_field/edit_component.rb
avo-3.5.3 app/components/avo/fields/trix_field/edit_component.rb
avo-3.5.2 app/components/avo/fields/trix_field/edit_component.rb
avo-3.5.1 app/components/avo/fields/trix_field/edit_component.rb
avo-3.5.0 app/components/avo/fields/trix_field/edit_component.rb
avo-3.4.4 app/components/avo/fields/trix_field/edit_component.rb
avo-3.4.3 app/components/avo/fields/trix_field/edit_component.rb
avo-3.4.2 app/components/avo/fields/trix_field/edit_component.rb
avo-3.4.1 app/components/avo/fields/trix_field/edit_component.rb
avo-3.4.0 app/components/avo/fields/trix_field/edit_component.rb
avo-3.3.6 app/components/avo/fields/trix_field/edit_component.rb
avo-3.3.5 app/components/avo/fields/trix_field/edit_component.rb
avo-3.3.4 app/components/avo/fields/trix_field/edit_component.rb