Class: Uchi::Ui::Actions::Dropdown

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
RoutesHelper
Defined in:
app/components/uchi/ui/actions/dropdown.rb

Overview

Renders a dropdown menu of actions that can be performed on a record.

This component displays available actions for a repository in a dropdown menu. Each action can be clicked to execute it on the specified record(s).

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RoutesHelper

#uchi_path_to

Constructor Details

#initialize(actions:, record:, repository:) ⇒ Dropdown

Returns a new instance of Dropdown.



15
16
17
18
19
20
# File 'app/components/uchi/ui/actions/dropdown.rb', line 15

def initialize(actions:, record:, repository:)
  super()
  @actions = actions
  @record = record
  @repository = repository
end

Instance Attribute Details

#actions ⇒ Object (readonly)

Returns the value of attribute actions.



13
14
15
# File 'app/components/uchi/ui/actions/dropdown.rb', line 13

def actions
  @actions
end

#record ⇒ Object (readonly)

Returns the value of attribute record.



13
14
15
# File 'app/components/uchi/ui/actions/dropdown.rb', line 13

def record
  @record
end

#repository ⇒ Object (readonly)

Returns the value of attribute repository.



13
14
15
# File 'app/components/uchi/ui/actions/dropdown.rb', line 13

def repository
  @repository
end

Instance Method Details

#render? ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'app/components/uchi/ui/actions/dropdown.rb', line 22

def render?
  actions.any?
end