-
-
Notifications
You must be signed in to change notification settings - Fork 637
[6.x] Hierarchical Taxonomies #15192
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
Open
jackmcdade
wants to merge
28
commits into
6.x
Choose a base branch
from
feature/hierarchical-taxonomies
base: 6.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+6,887
−169
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
45eff81
Add taxonomy structures so terms can be hierarchical.
jackmcdade 10f3c15
Add a CP tree view and orderable settings for hierarchical taxonomies.
jackmcdade 5bb6d3d
Nest hierarchical term URLs and expose parent/depth in tags.
jackmcdade c4f7503
Show term hierarchy in the terms fieldtype.
jackmcdade b67202b
Expose taxonomy trees in the REST API and GraphQL.
jackmcdade a78f822
Add per-taxonomy route control so URLs can be customized or disabled.
jackmcdade 0cf33e0
Treat custom taxonomy routes as full URL patterns, without collection…
jackmcdade 847503a
Improve creating nested terms in the terms fieldtype.
jackmcdade eabec93
Nest newly created term paths in the persisted taxonomy tree.
jackmcdade b6df8cb
Fix term edits not persisting when associated in another site.
jackmcdade 9ccca78
Let you choose whether deleting a parent term also deletes its children.
jackmcdade 88694c6
Fix deleted terms lingering in entries, and nest YAML term paths in t…
jackmcdade cee51e0
Treat max-depth-1 taxonomies as a flat reorderable list, like collect…
jackmcdade 9524988
Invalidate static cache using actual taxonomy routes, including custo…
jackmcdade b11a022
Show the taxonomy tree to anyone who can view it, and only allow edit…
jackmcdade 4077ebd
Validate taxonomy tree max depth on the server, not just in the UI.
jackmcdade c6ecf18
Rewrite nested term path references when a term is renamed.
jackmcdade 4855d99
Add a structure tag for taxonomy trees, matching collection and nav t…
jackmcdade 9671f59
Include descendant terms in taxonomy filters by default.
jackmcdade 6cb9333
Default hierarchical terms fields to the select dropdown so they can …
jackmcdade d21e752
Sort structured taxonomy terms by tree order in the CP list, matching…
jackmcdade 27a4d4c
Add a site selector to the taxonomy tree so localized titles and crea…
jackmcdade 0331ce3
Show parent breadcrumbs when creating a child term.
jackmcdade a2e8974
Expand CP entry listing term filters to include descendant terms in a…
jackmcdade 6b8b044
Add a term option to the link fieldtype, matching entry and asset.
jackmcdade 59dbd36
Scaffold taxonomy index and term templates, including hierarchy tags …
jackmcdade 7cad640
Replace term parent breadcrumbs with a relationship field so you can …
jackmcdade 4e95283
Import translation helpers
jackmcdade File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,27 +2,51 @@ | |
| <div | ||
| class="shadow-ui-sm relative z-(--z-index-above) flex w-full h-full items-center gap-2 rounded-lg border border-gray-300 bg-white px-3 [&:has(.cursor-grab)]:px-1.5 py-1.5 mb-1.5 last:mb-0 text-base dark:border-gray-700 dark:with-contrast:border-gray-500 dark:bg-gray-900" | ||
| > | ||
| <ui-icon name="handles" class="item-move sortable-handle size-4 cursor-grab text-gray-300 dark:text-gray-700" v-if="sortable" /> | ||
| <div class="flex flex-1 items-center line-clamp-1 text-sm text-gray-600 dark:text-gray-300"> | ||
| <ui-status-indicator v-if="item.status" :status="item.status" class="me-2" /> | ||
| <ui-icon name="handles" class="item-move sortable-handle size-4 shrink-0 cursor-grab text-gray-300 dark:text-gray-700" v-if="sortable" /> | ||
| <ui-status-indicator v-if="item.status" :status="item.status" class="shrink-0" /> | ||
|
|
||
| <div class="flex min-w-0 flex-1 flex-wrap items-baseline gap-x-1.5 gap-y-0.5 text-sm text-gray-600 dark:text-gray-300"> | ||
| <div | ||
| v-if="item.invalid" | ||
| v-tooltip.top="__('messages.relationship_item_unavailable')" | ||
| v-text="__(item.title)" | ||
| class="line-clamp-1 text-sm text-gray-500 dark:text-gray-400" | ||
| class="text-sm text-gray-500 dark:text-gray-400" | ||
| /> | ||
|
|
||
| <a | ||
| v-if="!item.invalid && editable" | ||
| @click.prevent="edit" | ||
| v-text="__(item.title)" | ||
| class="line-clamp-1 text-sm text-gray-600 dark:text-gray-300" | ||
| v-tooltip="item.title" | ||
| :href="item.edit_url" | ||
| /> | ||
| <template v-else> | ||
| <span | ||
| v-if="hintTaxonomy" | ||
| v-text="hintTaxonomy" | ||
| class="text-xs text-gray-400 dark:text-gray-500" | ||
| /> | ||
| <template v-if="hintPathSegments.length"> | ||
| <ui-badge | ||
| v-for="(segment, i) in hintPathSegments" | ||
| :key="i" | ||
| size="sm" | ||
| :text="segment" | ||
| /> | ||
| </template> | ||
| <template v-else-if="item.hint"> | ||
| <span | ||
| v-text="item.hint" | ||
| :title="item.hint" | ||
| class="text-xs text-gray-400 dark:text-gray-500" | ||
| /> | ||
| <span class="text-xs text-gray-300 dark:text-gray-600" aria-hidden="true">»</span> | ||
| </template> | ||
|
|
||
| <a | ||
| v-if="editable" | ||
| @click.prevent="edit" | ||
| v-text="__(item.title)" | ||
| class="text-sm text-gray-600 dark:text-gray-300" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest this should be |
||
| v-tooltip="item.title" | ||
| :href="item.edit_url" | ||
| /> | ||
|
|
||
| <div v-if="!item.invalid && !editable" v-text="__(item.title)" /> | ||
| <div v-else v-text="__(item.title)" /> | ||
| </template> | ||
|
|
||
| <inline-edit-form | ||
| v-if="isEditing" | ||
|
|
@@ -33,34 +57,26 @@ | |
| @updated="itemUpdated" | ||
| @closed="isEditing = false" | ||
| /> | ||
| </div> | ||
|
|
||
| <div class="flex flex-1 items-center justify-end"> | ||
| <div | ||
| v-if="item.hint" | ||
| v-text="item.hint" | ||
| class="text-2xs tracking-tight me-2 hidden whitespace-nowrap text-gray-500 @sm:block" | ||
| /> | ||
|
|
||
| <div class="flex items-center" v-if="!readOnly"> | ||
| <Dropdown> | ||
| <template #trigger> | ||
| <Button icon="dots" variant="ghost" size="xs" v-bind="$attrs" :aria-label="__('Open dropdown menu')" /> | ||
| </template> | ||
| <DropdownMenu> | ||
| <DropdownItem | ||
| v-if="editable" | ||
| :text="__('Edit')" | ||
| @click="edit" | ||
| /> | ||
| <DropdownItem | ||
| :text="__('Unlink')" | ||
| variant="destructive" | ||
| @click="$emit('removed')" | ||
| /> | ||
| </DropdownMenu> | ||
| </Dropdown> | ||
| </div> | ||
| </div> | ||
| <div class="flex shrink-0 items-center" v-if="!readOnly"> | ||
| <Dropdown> | ||
| <template #trigger> | ||
| <Button icon="dots" variant="ghost" size="xs" v-bind="$attrs" :aria-label="__('Open dropdown menu')" /> | ||
| </template> | ||
| <DropdownMenu> | ||
| <DropdownItem | ||
| v-if="editable" | ||
| :text="__('Edit')" | ||
| @click="edit" | ||
| /> | ||
| <DropdownItem | ||
| :text="__('Unlink')" | ||
| variant="destructive" | ||
| @click="$emit('removed')" | ||
| /> | ||
| </DropdownMenu> | ||
| </Dropdown> | ||
| </div> | ||
| </div> | ||
| </template> | ||
|
|
@@ -103,6 +119,24 @@ export default { | |
| }; | ||
| }, | ||
|
|
||
| computed: { | ||
| hintTaxonomy() { | ||
| if (!this.item.hint?.includes(' • ') || !this.item.hint.includes(' » ')) return null; | ||
|
|
||
| return this.item.hint.split(' • ')[0]; | ||
| }, | ||
|
|
||
| hintPathSegments() { | ||
| if (!this.item.hint?.includes(' » ')) return []; | ||
|
|
||
| const path = this.item.hint.includes(' • ') | ||
| ? this.item.hint.split(' • ').slice(1).join(' • ') | ||
| : this.item.hint; | ||
|
|
||
| return path.split(' » '); | ||
| }, | ||
| }, | ||
|
|
||
| methods: { | ||
| edit() { | ||
| if (!this.editable) return; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest this should be
text-gray-500 dark:text-gray-400to hit AA