-
Notifications
You must be signed in to change notification settings - Fork 178
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
selectable_column implementation #465
Comments
I don't have support for batch actions currently in the admin DSL yet (though it is on the roadmap), so right now the Having said that, the Hotwire updates I've released today (in particular full support for Stimulus controllers) will make this much easier to wire up manually. I'll be going through that on another project tomorrow. Once I have the process sorted, I'll post here with an outline. |
I've just pushed 014dc16 which adds a new The steps to implement are:
controller do
def batch_get
ids = params[:ids].split(",")
flash[:message] = { title: "Success!", message: "Performed batch action via GET with #{ids.size} articles." }
redirect_back fallback_location: admin.path
end
def batch_post
ids = params[:ids].split(",")
flash[:message] = { title: "Success!", message: "Performed batch action via POST with #{ids.size} articles." }
redirect_back fallback_location: admin.path
end
end
routes do
collection do
get :batch_get
post :batch_post
end
end The
<% toolbar(:secondary) do |t| %>
<%= t.link "Batch Action (GET)", action: :batch_get, style: :info, data: { controller: "batch-action" } %>
<%= t.link "Batch Action (POST)", action: :batch_post, style: :warning, data: { controller: "confirm batch-action", turbo_method: :post } %>
<% end %> The button trigger should be a link with |
I have poured over the source code for the select_column (selectable_column) that can be added to a table, but I have yet to determine what adding that column does or how to provide actions that can be performed once a row is selected. I don't see anywhere to add actions to a table that can be performed on a batch of selected items.
The text was updated successfully, but these errors were encountered: