Sha256: a6cac0b909d415b264ea110d21b3c499c2b0c63d7977c960eb85c808f00194bb

Contents?: true

Size: 1014 Bytes

Versions: 25

Compression:

Stored size: 1014 Bytes

Contents

# frozen_string_literal: true

class Avo::BaseComponent < ViewComponent::Base
  include Turbo::FramesHelper

  def has_with_trial(ability)
    ::Avo::App.license.has_with_trial(ability)
  end

  private

  # Figure out what is the corresponding field for this @reflection
  def field
    fields = ::Avo::App.get_resource_by_model_name(@reflection.active_record.name).get_field_definitions
    fields.find { |f| f.id == @reflection.name }
  rescue
    nil
  end

  def relation_resource
    ::Avo::App.get_resource_by_model_name params[:via_resource_class].safe_constantize
  end

  # Get the resource for the resource using the klass attribute so we get the namespace too
  def reflection_resource
    ::Avo::App.get_resource_by_model_name(@reflection.klass.to_s)
  rescue
    nil
  end

  # Get the resource for the resource using the klass attribute so we get the namespace too
  def reflection_parent_resource
    ::Avo::App.get_resource_by_model_name(@reflection.active_record.to_s)
  rescue
    nil
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
avo-2.13.4.pre.1 app/components/avo/base_component.rb
avo-2.13.3.pre.4 app/components/avo/base_component.rb
avo-2.13.3.pre.3 app/components/avo/base_component.rb
avo-2.13.3.pre.2 app/components/avo/base_component.rb
avo-2.13.3.pre.1 app/components/avo/base_component.rb
avo-2.13.2.pre.2 app/components/avo/base_component.rb
avo-2.13.2.pre.1 app/components/avo/base_component.rb
avo-2.13.1 app/components/avo/base_component.rb
avo-2.13.0 app/components/avo/base_component.rb
avo-2.12.1.pre.1 app/components/avo/base_component.rb
avo-2.12.0 app/components/avo/base_component.rb
avo-2.11.3.pre.3 app/components/avo/base_component.rb
avo-2.11.3.pre.2 app/components/avo/base_component.rb
avo-2.11.3.pre.1 app/components/avo/base_component.rb
avo-2.11.2.pre.3 app/components/avo/base_component.rb
avo-2.11.2.pre.2 app/components/avo/base_component.rb
avo-2.11.2.pre.1 app/components/avo/base_component.rb
avo-2.11.1.pre.3 app/components/avo/base_component.rb
avo-2.11.1 app/components/avo/base_component.rb
avo-2.11.1.pre.2 app/components/avo/base_component.rb