-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Autoroute container routing #5665
Conversation
# Conflicts: # src/OrchardCore.Modules/OrchardCore.Flows/Drivers/BagPartDisplay.cs
@agriffard if you had any time to try this, it'd be appreciated. Any better hint texts would also be helpful ;) I haven't as yet included autoroute on the taxonomy content type by default (probably it should be not sure?) so you would have to add it. I haven't updated the blog recipe or templates either, there are enough changes on this pr, I would do that on another pr |
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.
I love it.
If you find that my remark about a Container fieldset can add some value, please add it.
It is just a bit difficult to understand the impact of the different settings just thanks to the hints.
Can't wait to see some documentation (guide or in taxonomies module) and more integration in the BlogTheme, event it is in other PRs.
The biggest challenge is to make it understandable for everyone. As I see your discussion about Content tree, it makes me think that we should may be not present the feature as a Container/Contained items but as a Tree/Nodes/Leaves or as a Parent/Children relationship. Ex: A route that 'Can have children' is easier to understand than 'Can have contained items'. |
Good timing @agriffard I was just putting the field set in. You are right. The hardest part of this pr is make the ui... So I used Contained / Container because it is common Orchard terminology from O1 and also OC, but no one ever understands it (at first). And as the words are so similar, it is hard to differentiate. I am lazy so I would like to keep the code referring to Contained / Container. It makes more sense there I think, than Parent / Child (because sometimes a child can also be a parent when things are nested...) Tree/Node/Leaves works well for taxonomies (but is also quite Orchard specific), but doesn't make so much sense for BagParts. So to keep the UI a little bit similar to the code, how about I use Contained / Container for the Properties, but make the hints refer to parent / child. And on the content item itself: Open to any more suggestions to make this more easily understandable :) And is it translatable? |
Exactly what I was expecting. |
if (_autorouteEntries.TryGetEntryByContentItemId(context.ContentItem.ContentItemId, out var entry) && | ||
!string.IsNullOrEmpty(entry.ContainedContentItemId)) | ||
{ | ||
metadata.DisplayRouteValues = new RouteValueDictionary { |
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.
one side effect is that if contained item routing is not enabled, generating a route for it with a url helper will generate a standard route (i.e. /Contents/Item/id) which will 404
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.
This is ready for a review of design choices @sebastienros
I have also deleted a number of files from taxonomies that probably came across from menus and are unused.
Made a Term
and TermItem
shape similar to menu shapes, which are populated by drivers, and the TermPart
. This should enable most common uses to be overridden in liquid without having to make queries, as they are populated by drivers / other shapes.
I have added the Autoroute
part as part of migrations to taxonomies, and check that it is non breaking. Will require a republish and applying settings to work.
There would be a few follow up pr's, related to the blog theme templates, and probably a similar concept for the AliasPart
, and docs etc, once design choices are ratified
src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/AutoroutePartHandler.cs
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/AutoroutePartHandler.cs
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/AutoroutePartHandler.cs
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Autoroute/Indexes/AutoroutePartIndex.cs
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Autoroute/Routing/AutoRouteTransformer.cs
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Taxonomies/Drivers/TermPartContentDriver.cs
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Autoroute/Routing/AutoRouteTransformer.cs
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Taxonomies/Views/TaxonomyPart.cshtml
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Taxonomies/Views/TermItem.cshtml
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.ContentManagement.Abstractions/IContentManager.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.ContentManagement.Abstractions/Routing/AutorouteEntry.cs
Show resolved
Hide resolved
Little bit more progress here. @agriffard the blog theme is updated now :) It could do with another test drive if you have time. Here's some screen shots All the badges now have links to their category or tag There is now a |
Model.Metadata.Alternates.Clear(); | ||
Model.Metadata.Type = "TermContentItem"; | ||
|
||
tag.InnerHtml.AppendHtml(await DisplayAsync(Model)); |
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.
Not obvious that using InnerHtml is necessary. Looks like it could just work with some direct calls to @await displayAsync
. Unless you found a reason due to ordering that was not possible.
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.
No reason. I just hadn't done it that way. Have removed the tagbuilder and done directly with @await DisplayAsync()
|
||
The display for the `Taxonomy` is then rendered by the `TaxonomyPart` shape. | ||
|
||
This uses the `TermShape` to display a heirachy of the `Terms` |
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.
heirachy => hierarchy
|
||
The `TermPart` is rendered when a `Term` is displayed with the `Container routing` feature of the `AutoroutePart`. | ||
|
||
It renders a list of all content items that have been categorized by the `TaxonomyField` as part of that `Term` hierachy. |
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.
hierachy => hierachy
|
||
### Term Shape | ||
|
||
The `TermShape` is used by the `TaxonomyPart` display to render the list of term hierachies for the `Taxonomy`. |
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.
hierachies => hierarchies
|
||
The `TermShape` is used by the `TaxonomyPart` display to render the list of term hierachies for the `Taxonomy`. | ||
|
||
It is a reusable shape which may also be called from a content item, similar to that of a `MenuShape`, to render either the entire `Taxonomy` and term hierachy, or a part of the `Term` hierachy. |
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.
hierachy => hierarchy twice
<shape type="Term" alias="Categories" /> | ||
``` | ||
|
||
You can also specify a `TermContentItemId` to render a part of the term hierachy. |
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.
hierachy => hierarchy
Fixes #2688
Replaces #5455
Merged all required settings into Autoroute.