Sha256: ef2601c71c44afb2840e1661aa557ce5e4c0b548d02ae8e6991c5e3535cf8153

Contents?: true

Size: 767 Bytes

Versions: 2

Compression:

Stored size: 767 Bytes

Contents

# frozen_string_literal: true

class Avo::Index::Ordering::ButtonComponent < Avo::Index::Ordering::BaseComponent
  attr_accessor :resource
  attr_accessor :reflection
  attr_accessor :direction
  attr_accessor :svg

  def initialize(resource:, direction:, svg: nil,  reflection: nil)
    @resource = resource
    @reflection = reflection
    @direction = direction
    @svg = svg
  end

  def render?
    order_actions[direction].present?
  end

  def order_path(args)
    if reflection.present?
      Avo::App.view_context.avo.associations_order_path(reflection_parent_resource.route_key, params[:id], field.id, resource.model.id, **args)
    else
      Avo::App.view_context.avo.resources_order_path(resource.route_key, resource.model.id, **args)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
avo-2.10.2 app/components/avo/index/ordering/button_component.rb
avo-2.10.0 app/components/avo/index/ordering/button_component.rb