Sha256: 7503205b8648f3866af33b9392832a8356d14d5857fd11e7d294b6e6d056d993

Contents?: true

Size: 613 Bytes

Versions: 56

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true

class Avo::Fields::TiptapField::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 tiptap_id
    if resource_name.present?
      "tiptap_#{resource_name}_#{@field.id}"
    elsif form.present?
      "tiptap_#{form.index}_#{@field.id}"
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
avo-3.14.3 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.14.2 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.14.1 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.14.0 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.13.7 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.13.6 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.13.5 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.13.4 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.13.3 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.13.2 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.13.1 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.13.0 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.12.0 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.11.10 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.11.9 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.11.8 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.11.7 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.11.6 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.11.5 app/components/avo/fields/tiptap_field/edit_component.rb
avo-3.11.4 app/components/avo/fields/tiptap_field/edit_component.rb