Module: Godmin::Resources::ResourceService::BatchActions
- Extended by:
- ActiveSupport::Concern
- Included in:
- Godmin::Resources::ResourceService
- Defined in:
- lib/godmin/resources/resource_service/batch_actions.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #batch_action(action, records) ⇒ Object
- #batch_action?(action) ⇒ Boolean
- #include_batch_action?(action) ⇒ Boolean
- #include_batch_actions? ⇒ Boolean
Instance Method Details
#batch_action(action, records) ⇒ Object
9 10 11 12 13 14 15 16 |
# 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) ⇒ Boolean
18 19 20 |
# 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) ⇒ Boolean
22 23 24 25 26 27 28 |
# File 'lib/godmin/resources/resource_service/batch_actions.rb', line 22 def include_batch_action?(action) = batch_action_map[action.to_sym] ([:only].nil? && [:except].nil?) || ([:only] && [:only].include?(scope.to_sym)) || ([:except] && ![:except].include?(scope.to_sym)) end |
#include_batch_actions? ⇒ Boolean
30 31 32 33 34 |
# 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 |