Module: Godmin::Helpers::BatchActions

Defined in:
lib/godmin/helpers/batch_actions.rb

Instance Method Summary collapse

Instance Method Details



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/godmin/helpers/batch_actions.rb', line 4

def batch_action_link(name, options)
  if (options[:only].nil? && options[:except].nil?) ||
     (options[:only] && options[:only].include?(params[:scope].to_sym)) ||
     (options[:except] && !options[:except].include?(params[:scope].to_sym))

    link_to(translate_scoped("batch_actions.#{name}", default: name.to_s.titleize), "#", class: "btn btn-default batch-actions-action-link hidden", data: {
      value: name,
      confirm: options[:confirm] ? translate_scoped("batch_actions.confirm_message") : false
    })
  end
end