avo-hq/avo

Paginated resource selection

Open

#2,824 创建于 2024年5月31日

在 GitHub 查看
 (3 评论) (0 反应) (0 负责人)Ruby (1,778 star) (308 fork)user submission
FeatureHelp wantedJavascriptUI

描述

Feature

On the index page of a resource, or when viewing nested resources on a resource show page, when a user selected a one or more records and then cicks on a pagination link/button the selected resources are not persisted.

Ideally a user would be able to select multiple resources across the paginated records and then bulk delete or perform a bulk action.

Right now, it is not clear to the user the the prior resources are no longer selected.

Current workarounds

For smaller collections of resources it is possible to increase the number of items per page to select more than the default pagination amount, but for larger collections this would likely cause memory issues.

Screenshots or screen recordings

https://github.com/avo-hq/avo/assets/3110565/deb847e2-04f7-4546-912a-07aa8a4bbf65

The video shows what happens when selecting a resource from the blog posts on the AVO demo site. When no records are selected the action is disabled, which occurs after changing pages. When navigating back the checkbox briefly shows as selected but I think this is just due to browser caching, as no params are passed in the the pagination request related to selected resources.

Additional context

I have not seen this behavior implemented elsewhere. This could potentially be solved by having a stimulus controller tracking the selected items, or by making a get request when checkboxes are updated, and use turboframes/streams to update the pagination links with the currently selected resources, and then create hidden form fields for the resources not shown on the page.

It might be a good idea to indicate to the user the number of resources currently selected, so that they are not performing actions/deleting records they are unaware of.

贡献者指南

Paginated resource selection · avo-hq/avo#2824 | Good First Issue