Class: Jav::Index::Ordering::ButtonComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/jav/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.



6
7
8
9
10
11
# File 'app/components/jav/index/ordering/button_component.rb', line 6

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.



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

def direction
  @direction
end

#reflectionObject

Returns the value of attribute reflection.



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

def reflection
  @reflection
end

#resourceObject

Returns the value of attribute resource.



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

def resource
  @resource
end

#svgObject

Returns the value of attribute svg.



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

def svg
  @svg
end

Instance Method Details

#order_path(args) ⇒ Object



17
18
19
# File 'app/components/jav/index/ordering/button_component.rb', line 17

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

#render?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/components/jav/index/ordering/button_component.rb', line 13

def render?
  order_actions[direction].present?
end