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

[5.x] Ability for relationship/entries fieldtype to add "hints" #10447

Merged
merged 12 commits into from
Jul 17, 2024

Conversation

jasonvarga
Copy link
Member

@jasonvarga jasonvarga commented Jul 12, 2024

This PR adds the ability for the relationship fieldtype to display "hints".

Hints are necessary when you have multiple options that could have the same value. For example if you have two entries in different collections with the same title, you don't know which is which:

CleanShot 2024-07-15 at 16 50 14

The entries fieldtype already had this solved when in "stacked" mode because the collection is displayed as a column in the listing as well as having the collection title as a hardcoded hint in the selected item.

CleanShot 2024-07-15 at 16 53 49

CleanShot 2024-07-15 at 16 47 00

This PR makes the concept of these hints more generic across relationship fieldtypes.

  • For the entries fieldtype specifically it uses the collection title to keep it behaving the same when in stacked mode.
  • For the terms fieldtype it'll use the taxonomy titles.

This PR also improves the dropdown modes (select and typeahead) by adding hints and status icons to the dropdown options:

CleanShot 2024-07-15 at 17 16 42

Lastly, this PR makes the selected items of the dropdown mode consistent with stacked mode:

CleanShot 2024-07-15 at 16 59 23

Aside from a consistent UI, this allows the dropdown mode to have inline editing by clicking the item titles.

Replaces / Fixes #9749
Closes statamic/ideas#559
Allows #9229 to display the site name as part of the hint.

@jasonvarga
Copy link
Member Author

@jackmcdade, what this is doing is adding the hints to the right hand side of the dropdown options, like this:

CleanShot 2024-07-15 at 14 59 16

But now I need to figure out what to do about the selected items:

CleanShot 2024-07-15 at 15 00 36

When you have it in stack mode, you already got those hints:

CleanShot 2024-07-15 at 15 01 10

Should we just reuse those? You'd also get status icons and ability to inline-edit the items for free too.

@jasonvarga jasonvarga marked this pull request as draft July 15, 2024 19:04
@jackmcdade
Copy link
Member

Yeah i think using RelationShip items could work – I've been wanting to give those a UI update for a while now too. If they use the same component, they'd get an update for free too 🤘

@jasonvarga
Copy link
Member Author

Alrighty, now here's a standard stack based entries field and a dropdown based one:

CleanShot 2024-07-15 at 16 41 52

@jasonvarga jasonvarga changed the title [5.x] Ability for relationship/entries fieldtype to add dropdown option hints [5.x] Ability for relationship/entries fieldtype to add "hints" Jul 15, 2024
@jasonvarga
Copy link
Member Author

I've updated the description of the PR with more detail and screenshots.

@jasonvarga jasonvarga marked this pull request as ready for review July 15, 2024 21:19
@johncarter-
Copy link
Contributor

Probably closes or half closes: statamic/ideas#559

@jasonvarga
Copy link
Member Author

@johncarter- I've just applied the hint treatment to the terms fieldtype so now this PR can completely close that issue. Thanks for pointing it out.

Copy link
Member

@jackmcdade jackmcdade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love it. I have some ideas for some UI improvements but they are broader, more generic, and cosmetic only. This a big UX win. Let’s ship it!

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.

Show taxonomy name in term fieldtype select drop down
3 participants