module Godmin::Resources::ResourceService::BatchActions

Public Instance Methods

batch_action(action, records) click to toggle source
# File lib/godmin/resources/resource_service/batch_actions.rb, line 9
def batch_action(action, records)
  if batch_action?(action)
    send("batch_action_#{action}", records)
    true
  else
    false
  end
end
batch_action?(action) click to toggle source
# File lib/godmin/resources/resource_service/batch_actions.rb, line 18
def batch_action?(action)
  batch_action_map.key?(action.to_sym)
end
include_batch_action?(action) click to toggle source
# File lib/godmin/resources/resource_service/batch_actions.rb, line 22
def include_batch_action?(action)
  options = batch_action_map[action.to_sym]

  (options[:only].nil? && options[:except].nil?) ||
    (options[:only] && options[:only].include?(scope.to_sym)) ||
    (options[:except] && !options[:except].include?(scope.to_sym))
end
include_batch_actions?() click to toggle source
# File lib/godmin/resources/resource_service/batch_actions.rb, line 30
def include_batch_actions?
  batch_action_map.keys.any? do |action|
    include_batch_action?(action)
  end
end