Module: ActiveAction::ViewHelpers

Defined in:
lib/active_action/view_helpers.rb

Constant Summary collapse

NO_ACTIVE_ACTIONS_MESSAGE =
"<!-- No active actions found. -->"
DEFAULT_LABEL =
"Active actions"

Instance Method Summary collapse

Instance Method Details

#active_actions_button(label) ⇒ Object



10
11
12
# File 'lib/active_action/view_helpers.rb', line 10

def active_actions_button(label)
  active_actions_button_for(:all, label: label)
end

#active_actions_button_for(scopes = [:all], label: DEFAULT_LABEL, renderer: BootstrapDropdown) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/active_action/view_helpers.rb', line 14

def active_actions_button_for(scopes = [:all], label: DEFAULT_LABEL, renderer: BootstrapDropdown)
  actions = active_actions_for(scopes)
  if actions.empty?
    return NO_ACTIVE_ACTIONS_MESSAGE.html_safe
  end
  renderer.to_html(label: label, actions: actions)
end

#active_selection_tag(value, checked = false, options = {}) ⇒ Object



6
7
8
# File 'lib/active_action/view_helpers.rb', line 6

def active_selection_tag(value, checked = false, options = {})
  check_box_tag 'collection_ids[]', value, checked, {class: 'active_actions_selection'}.merge(options)
end