-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
343310 - Bulk action on Servers #298
base: master
Are you sure you want to change the base?
343310 - Bulk action on Servers #298
Conversation
About futures implementations of bulk actions on other resources:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have ask user confirmation before deleting, with a text informing the user how many items is going to delete
We should have to thing a bit more of the future actions that may be implemented. I think at least the stimulus controller may be declared inside the datatable to make it easier than add it in every form. May be slot could be use to declare actions. c.with_bulk_action("Destroy all", bulk_destroy_servers_path, method: :delete) We also could imagine that bulk is automatically enabled when at least one "slot" is added. |
config/routes.rb
Outdated
@@ -55,6 +55,7 @@ | |||
post :sort | |||
get :import_csv | |||
post :import | |||
post :bulk_manage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer patch
def bulk_manage | ||
@items = params[:item_ids].map { |id| resource_class.find(id) } | ||
|
||
if params[:bulk_destroy] | ||
bulk_destroy | ||
else | ||
redirect_back fallback_location: root_path | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may imagine having this just as a proxy, and having bulk_destroy
in the ServerController.
And if we have bulk_disable
button later, then we may just need to have a bulk
disable action in the controller.
0f16a27
to
939f553
Compare
BulkDataTableComponent
?