Resolve "Repeat element: implement the new element"
What is in this MR
This MR is the second step in getting the repeat element implemented. In this MR we flesh out the RepeatElement
in the frontend and backend.
The experience of using the repeat element changes based on the mode
:
In the editor
- You can add a
RepeatElement
as you would a normal container (e.g. column, form). - Elements, currently any of them, can be added to the container.
- The
RepeatElement
is configured in its form by choosing a list data source, and optionally how many results per page to display. - Regardless of how many items are in the dispatched data source, in the editor, we show one iteration of the elements in the container.
In preview and published
- We now repeat the elements inside the container, based on how many
items_per_page
is configured (by default: 20). If there are more thanitems_per_page
results, then a "Show more" button appears, just like the table element.
What is not in this MR
It's not currently possible to use the current_record
provider in formulas, this will come in MR 3. You can just, for now, freely add formulas to the elements and the same values are repeated n
times.
How to test this MR
This feature is behind a feature flag. You will need to add builder-repeat-element
to FEATURE_FLAGS
in your .env
file. You don't need to do this if your FEATURE_FLAGS
is *
.
- Create a page.
- Add a list data source to it.
- Add a repeat element to the page, and connect it to the data source.
- Add one or more elements to the repeat element.
- Preview your page / publish your application and confirm that the elements in your container are repeated
items_per_page
times. Ifitems_per_page
is smaller than the total data source result count, then ensure the "Show more" button works correctly.
Merge Request Checklist
-
changelog.md has been updated if required.- I'll do a changelog entry in the final MR.
-
New/updated Premium/Enterprise features are separated correctly in the premium or enterprise folder -
The latest Chrome and Firefox have been used to test any new frontend features -
Documentation has been updated -
Quality Standards are met -
Performance: tables are still fast with 100k+ rows, 100+ field tables -
The redoc API pages have been updated for any REST API changes -
Our custom API docs are updated for changes to endpoints accessed via api tokens -
The UI/UX has been updated following UI Style Guide
Closes #2519 (closed)
Edited by Peter Evans