Module: Ui::Actionable

Included in:
Card, Collapse::Panel, DescriptiveList, Empty, List, Notification, PageHeader, Table
Defined in:
lib/ui/actionable.rb

Constant Summary collapse

Actions =
Types::Array.default([].freeze).of(Types::Callable)

Instance Method Summary collapse

Instance Method Details

#actionsObject



5
6
7
8
9
10
11
12
13
# File 'lib/ui/actionable.rb', line 5

def actions
  (:nav, class: 'ui-actions', role: 'navigation') do
    render_group(
      Actions[actions_list].map do |action|
        action.call(model)
      end
    )
  end
end

#actions_lengthObject



19
20
21
# File 'lib/ui/actionable.rb', line 19

def actions_length
  options.fetch(:actions, Array.new).size
end

#actions_listObject



15
16
17
# File 'lib/ui/actionable.rb', line 15

def actions_list
  options.fetch(:actions, Array.new) || Array.new
end

#has_actions?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/ui/actionable.rb', line 23

def has_actions?
  actions_list.any?
end