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.
555 556 557 558 559 |
# File 'lib/admin/base/resource.rb', line 555 def initialize @member_actions = [] @collection_actions = [] @bulk_actions = [] end |
Instance Attribute Details
#bulk_actions ⇒ Object (readonly)
Returns the value of attribute bulk_actions.
553 554 555 |
# File 'lib/admin/base/resource.rb', line 553 def bulk_actions @bulk_actions end |
#collection_actions ⇒ Object (readonly)
Returns the value of attribute collection_actions.
553 554 555 |
# File 'lib/admin/base/resource.rb', line 553 def collection_actions @collection_actions end |
#member_actions ⇒ Object (readonly)
Returns the value of attribute member_actions.
553 554 555 |
# File 'lib/admin/base/resource.rb', line 553 def member_actions @member_actions end |
Instance Method Details
#action(name, **options) ⇒ Object
561 562 563 564 565 566 567 568 569 570 571 572 573 |
# File 'lib/admin/base/resource.rb', line 561 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
587 588 589 590 591 592 593 594 595 596 597 |
# File 'lib/admin/base/resource.rb', line 587 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
575 576 577 578 579 580 581 582 583 584 585 |
# File 'lib/admin/base/resource.rb', line 575 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 |