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

Inherits:
ViewComponent::Base
  • Object
show all
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

Constructor Details

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

Returns a new instance of Dropdown.



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

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

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



11
12
13
# File 'app/components/uchi/ui/actions/dropdown.rb', line 11

def actions
  @actions
end

#recordObject (readonly)

Returns the value of attribute record.



11
12
13
# File 'app/components/uchi/ui/actions/dropdown.rb', line 11

def record
  @record
end

#repositoryObject (readonly)

Returns the value of attribute repository.



11
12
13
# File 'app/components/uchi/ui/actions/dropdown.rb', line 11

def repository
  @repository
end

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/components/uchi/ui/actions/dropdown.rb', line 20

def render?
  actions.any?
end