Skip to content
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 item at the top if top button is clicked in list field #105

Merged
merged 2 commits into from
Feb 7, 2021

Conversation

Karmalakas
Copy link
Contributor

@Karmalakas Karmalakas commented Feb 3, 2021

Pretty much title says it all. IMO it makes much more sense, that top button would add item at the top, because if list is long enough, you are not even seeing if something happens when item is added at the bottom. Created this PR because of the question asked in forum. Also created same change PR for Admin plugin

So the solution would be either like this PR suggests, or button actions should be configurable via plugin config.

Pretty much title says it all. IMO it makes much more sense, that top button would add item at the top, because if list is long enough, you are not even seeing if something happens when item is added at the bottom. Created this PR because of [the question asked in forum](https://discourse.getgrav.org/t/blueprint-type-list-new-data-on-top-of-array/15254).

So the solution would be either like this PR suggests, or button actions should be configurable via plugin config.
If `placement` value is `top` or `bottom`, both buttons add item to top or bottom respectively.
If `placement` value is `position`, item is added depending on a clicked button position -
  if top button is clicked, item added to top and if bottom button, item added to bottom.

Defaults to `bottom`
@Karmalakas
Copy link
Contributor Author

Added field placement property check.

If placement value is top or bottom, both buttons add item to top or bottom respectively.
If placement value is position, item is added depending on a clicked button position - if top button is clicked, item added to top and if bottom button, item added to bottom.

Defaults to bottom

Tested by adding List field to user/plugins/flex-objects/blueprints/flex-objects/contacts.yaml and editing a contact in Admin

@Karmalakas
Copy link
Contributor Author

Created PR for docs

@w00fz w00fz merged commit f4b9b7b into trilbymedia:develop Feb 7, 2021
w00fz added a commit that referenced this pull request Feb 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants