Add new_item_builder option to Ecto Adapter #737
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change allows you to change the default form prefill when creating a new entry. This is useful, for example, if we want to create an action to copy an item, or create an item based on a template - these cases are very common in administration.
Example of an action to create a copy of an item:
Add a copy action using item_action:
Add action to LiveResource:
Up to now, everything can be done with standard Backpex tools. But we need to create an item with pre-filled values. This is not possible now, but modifying to multiple lines would allow such flexibility.
I suggest to add new optional adapter option new_item_builder , its use would then look like this:
The implementation is very straightforward. Instead of the existing code for creating new items:
use this
I think this small change would increase the possibilities that Backpex offers.