Class: Avo::Index::Ordering::ButtonComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/avo/index/ordering/button_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource:, direction:, svg: nil, reflection: nil) ⇒ ButtonComponent

Returns a new instance of ButtonComponent.



9
10
11
12
13
14
# File 'app/components/avo/index/ordering/button_component.rb', line 9

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

Instance Attribute Details

#directionObject

Returns the value of attribute direction.



6
7
8
# File 'app/components/avo/index/ordering/button_component.rb', line 6

def direction
  @direction
end

#reflectionObject

Returns the value of attribute reflection.



5
6
7
# File 'app/components/avo/index/ordering/button_component.rb', line 5

def reflection
  @reflection
end

#resourceObject

Returns the value of attribute resource.



4
5
6
# File 'app/components/avo/index/ordering/button_component.rb', line 4

def resource
  @resource
end

#svgObject

Returns the value of attribute svg.



7
8
9
# File 'app/components/avo/index/ordering/button_component.rb', line 7

def svg
  @svg
end

Instance Method Details

#order_path(args) ⇒ Object



20
21
22
# File 'app/components/avo/index/ordering/button_component.rb', line 20

def order_path(args)
  Avo::App.view_context.avo.reorder_order_path(resource.route_key, resource.model.to_param, **args)
end

#render?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'app/components/avo/index/ordering/button_component.rb', line 16

def render?
  order_actions[direction].present?
end