-
Notifications
You must be signed in to change notification settings - Fork 177
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
Add collection actions support #186
Comments
Is this issue exists in the roadmap? |
Would be very usefull, someone can point out how the code can be extended to support this, it's not easy to understand but I'm willing to help |
hello guys, just wanted to post a workaround: app/admin/clients_admin.rb: Trestle.resource(:clients) do
controller do
def export
# ...
end
end
routes do
get :export, on: :collection
end
end app/views/admin/clients/index.html.haml: ...
- toolbar(:primary) do |t|
= t.link('Export', export_clients_admin_index_path)
... you can find full source of this file here: https://github.com/TrestleAdmin/trestle/blob/master/app/views/trestle/resource/index.html.erb |
I've found an easy solution without the need of a custom template: Trestle.resource(:properties) do
...
hook("resource.index.header") do
content_tag(:div, style: "order: 2;align-self: center;") do
link_to(button_tag("Export", icon: 'fa fa-file', class: "btn btn-primary"), export_properties_admin_index_path(format: :xlsx), target: :_blank)
end
end
...
end |
I found another workaround which adds new buttons/links to proper toolbar instead of table's toolbar.
|
One issue with this is that it does not integrate with the |
It would be nice to have support for collection actions NOT just member action as already described in the documentation.
ActiveAdmin has those https://activeadmin.info/8-custom-actions.html#collection-actions so we can emulate that design.
It is really useful to be able to import/export records.
Looking at the trestle code, I see we are using
toolbar(:primary)
in the ERB template to render the toolbar. Maybe something like this:Relates to #185
The text was updated successfully, but these errors were encountered: