Class: Admin::Base::Resource::ActionsConfig
- Inherits:
-
Object
- Object
- Admin::Base::Resource::ActionsConfig
- Defined in:
- lib/admin/base/resource.rb
Instance Attribute Summary collapse
-
#bulk_actions ⇒ Object
readonly
Returns the value of attribute bulk_actions.
-
#collection_actions ⇒ Object
readonly
Returns the value of attribute collection_actions.
-
#member_actions ⇒ Object
readonly
Returns the value of attribute member_actions.
Instance Method Summary collapse
- #action(name, **options) ⇒ Object
- #bulk_action(name, **options) ⇒ Object
- #collection_action(name, **options) ⇒ Object
-
#initialize ⇒ ActionsConfig
constructor
A new instance of ActionsConfig.
Constructor Details
#initialize ⇒ ActionsConfig
Returns a new instance of ActionsConfig.
489 490 491 492 493 |
# File 'lib/admin/base/resource.rb', line 489 def initialize @member_actions = [] @collection_actions = [] @bulk_actions = [] end |
Instance Attribute Details
#bulk_actions ⇒ Object (readonly)
Returns the value of attribute bulk_actions.
487 488 489 |
# File 'lib/admin/base/resource.rb', line 487 def bulk_actions @bulk_actions end |
#collection_actions ⇒ Object (readonly)
Returns the value of attribute collection_actions.
487 488 489 |
# File 'lib/admin/base/resource.rb', line 487 def collection_actions @collection_actions end |
#member_actions ⇒ Object (readonly)
Returns the value of attribute member_actions.
487 488 489 |
# File 'lib/admin/base/resource.rb', line 487 def member_actions @member_actions end |
Instance Method Details
#action(name, **options) ⇒ Object
495 496 497 498 499 500 501 502 503 504 505 506 507 |
# File 'lib/admin/base/resource.rb', line 495 def action(name, **) @member_actions << ActionDefinition.new( name: name, method: [:method] || :post, confirm: [:confirm], type: [:type] || :button, label: [:label] || name.to_s.humanize, icon: [:icon], color: [:color], if_condition: [:if], unless_condition: [:unless] ) end |
#bulk_action(name, **options) ⇒ Object
521 522 523 524 525 526 527 528 529 530 531 |
# File 'lib/admin/base/resource.rb', line 521 def bulk_action(name, **) @bulk_actions << ActionDefinition.new( name: name, method: [:method] || :post, confirm: [:confirm], type: [:type] || :button, label: [:label] || name.to_s.humanize, icon: [:icon], color: [:color] ) end |
#collection_action(name, **options) ⇒ Object
509 510 511 512 513 514 515 516 517 518 519 |
# File 'lib/admin/base/resource.rb', line 509 def collection_action(name, **) @collection_actions << ActionDefinition.new( name: name, method: [:method] || :post, confirm: [:confirm], type: [:type] || :button, label: [:label] || name.to_s.humanize, icon: [:icon], color: [:color] ) end |