Add ability to select all accounts matching search for batch actions (#19053)
This commit is contained in:
parent
d696f729f1
commit
5b0e8cc92b
7 changed files with 138 additions and 4 deletions
|
@ -6,7 +6,8 @@ class Form::AccountBatch
|
|||
include AccountableConcern
|
||||
include Payloadable
|
||||
|
||||
attr_accessor :account_ids, :action, :current_account
|
||||
attr_accessor :account_ids, :action, :current_account,
|
||||
:select_all_matching, :query
|
||||
|
||||
def save
|
||||
case action
|
||||
|
@ -60,7 +61,11 @@ class Form::AccountBatch
|
|||
end
|
||||
|
||||
def accounts
|
||||
Account.where(id: account_ids)
|
||||
if select_all_matching?
|
||||
query
|
||||
else
|
||||
Account.where(id: account_ids)
|
||||
end
|
||||
end
|
||||
|
||||
def approve!
|
||||
|
@ -118,4 +123,8 @@ class Form::AccountBatch
|
|||
log_action(:approve, account.user)
|
||||
account.user.approve!
|
||||
end
|
||||
|
||||
def select_all_matching?
|
||||
select_all_matching == '1'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue