-
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
Add "Display Header" property to ListPartSettings #12525
Add "Display Header" property to ListPartSettings #12525
Conversation
…tPart # Conflicts: # src/OrchardCore.Themes/TheAdmin/wwwroot/css/TheAdmin.min.css
@sebastienros @Skrypt I change this so it's a ListPart settings instead of using DisplayMode. |
@sebastienros I updated the header from menu to buttons as per your request |
src/OrchardCore.Modules/OrchardCore.Lists/Drivers/ContainedPartDisplayDriver.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Lists/Views/ListPart.DisplayOption.cshtml
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Lists/Views/ListPartNavigation.cshtml
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Lists/Drivers/ContainedPartDisplayDriver.cs
Show resolved
Hide resolved
Yes, we already can render any shape in any zone, and that's a good customization, but no sure we need it oob as we may often need different ones.
As said in the review would be good to complete the |
@jtkech action bar is only available for hen you "list items". It's not available when editing the container or creating/editing a contained item. IMO, the great thing about adding the buttons on a new bar that is available while navigating around the container is that the user experience the same layout as he/she navigate around in the container. It's much better user experience and less confusing. Additionally, it's a common use case that one user want to show a header for their container. So when the user navigates around the container, they always see a quick overview about the container itself. In the example I provided in the PR, the container is a "Business". A business contains "Locations" and "Contact" and could have many other types contained with in it. As you navigate around, it's extremely useful to get a small overview on the top of the business as new items being added/editing under it. |
I'm reffering to the new |
Yes I understand. I am also saying that the navigation is an important change to improve user experience. With that change, the user will see that navigation bar across all any item that is related to the current container. So it's easy to navigate to any parts of the container. |
src/OrchardCore.Modules/OrchardCore.Lists/Drivers/ContainedPartDisplayDriver.cs
Outdated
Show resolved
Hide resolved
Okay, just saw the meeting where you discussed on this, in my above comment #12525 (comment) I was not talking about the Header I'm not against, that's okay as it is optional. Hmm maybe we could have find a way to not have to query twice the container (maybe currently for Latest and Published). For the other points in #12525 (comment) I still think quite the same, particularly when we want to save space, we may prefer to provide a smaller link to go back to the list, keep the buttons inline the search box. Also because for now it is a little breaking as the nav buttons are moved from an existing shape But I don't want to block anything, in a future upgrade I may let the header hidden, easy to override the new Note: Also as said in the review would be good to complete the ContainedPartIndex. |
If we store the owner name in the contained part, then we can create a dummy content item with the same owner and check to see if the user can edit the container. At the same time, even if we decided to store the owner in the containedPart, that would be a breaking change since old data will not have the owner name. The owner is needed to determine if the user can edit their own containers. However, we could check for owner name first, and if there is no owner name we can execute the second query to get info about the container. Updated Another note here is that we only run the second query when we are editing or creating a new contained item not when we display the
This would only impact users that are overriding the
I am not against the idea of adding "Back" button when IMP, for a |
…Apps/OrchardCore into ProfileDisplayModeListPart
@MikeAlhayek Okay, I will fork your branch, better to have the code locally to try it, and then review it when I will have time but as soon as possible. |
Okay the code looks good to me, we can also plan to update the What I suggest is to have another settings to render or not the navigation buttons, as we have to render the header or not. Then if this new setting is false (by default) Also the new Not sure about the |
@jtkech no bother at all. I'll update the index tomorrow. I personally don't see the value of adding the DisplayText/contentVersion in the index since it's already indexed in the ContentItemIndex but I am sure that I am missing something. Would you want a bool column for latest and another for published? Or, do you want a single column with the version? I'll also look so see if I can drop the added display driver as you suggested and change the Header to HeaderAdmin. Thanks for digging into this one! I'll ping you again once I update it Updated |
@jtkech all requested changed were made and re-tested. |
@MikeAlhayek Okay cool will review it tomorrow.
Okay, I will think about it. Yes it was to save space by default, for me in the List the search box is now too large, and while editing an item usualy I just add a smaller link (with the name of the container) to return back to the List, like the cancel button does but targetting the Title zone at the top. That's funny, we already have an admin setting to save space by putting the Title in the NavbarTop. Anyway only a minor problem, here maybe better to just do what others prefer. |
@jtkech I made the agreed on changes. Let me know if you see something else that needs to be done. |
I didn't agree, just suggested to remove the changes related to
Yes there are a lot of articles about column order, index sizes, splitting in lighter ones based on planned queries, like in the life nobody really know but there are many gurus, I even saw indexes not used at the beginning but then used later on by the sql optimizer. The compromise we found, tried with query plans and profilers, and then used as a convention is to use as possible only one index including all columns which covers most of the cases including queries we don't know by advance.
Because of the above and it's not a large index, the light Anyway having columns in the Index Table that are not in the There is another issue with So in the |
@jtkech I would follow the existing convention and just add all column to the index. Even though, I do not agree that is a good idea. When the index is too small, doing a table scan may be cheaper for SQL server than analyzing and using the index. This may be the reason why no index is used in some cases. I think in OC, we should only index the queries that we are using. And yes, not all columns have to appear in an index for the query to perform best. I work with large data and saw many scenarios like this. If someone is using OC or any other platform, and the data become large, they would run the profiler on the server side to find bad queries that are often repeated and manually index when needed. I think by default only ids should be indexed since these column we use is join or in where statements. Keep in mind that most things does need index in SQL to perform. Index are good when the data is large “we should not assume data will always be large”. Also, remember tat indexes are not cheap as rebuilding indexes comes at a cost. I'll also add the published or latest in the index provider in the morning. Let me know if you want more changes before then. |
Okay cool, yes we read many contradictory articles like this which led us to this compromise. |
@jtkech all requested changes were made. let me know if you have any additional changes. |
Okay cool, will review it asap, this night or tomorrow |
Before reviewing tomorrow, for the OrchardCore/src/OrchardCore.Modules/OrchardCore.Lists/Services/ContainerService.cs Lines 371 to 377 in 3dacb34
I suggest to use the following for existing installations to filter the soft deleted items that are already there, even if now we don't index them anymore.
|
Updated |
Okay LGTM, I will approve. I only suggest to apply everywhere the same following ordering, in the index provider and migrations, even in the Create() method that will only be run on fresh installations.
|
@jtkech I reordered the index to match the properties order. Please don't forget to approve this PR. |
Sorry, maybe I was not clear, here a suggested ordering
You can also rename ContainedContentItemId to ContentItemId. Not so crucial so anyway I will approve tomorrow But in the meantime if you can apply this ordering in the index provider and migrations. |
@jtkech updated. |
src/OrchardCore.Modules/OrchardCore.Contents/Views/Content.HeaderAdmin.cshtml
Outdated
Show resolved
Hide resolved
…derAdmin.cshtml Co-authored-by: Hisham Bin Ateya <[email protected]>
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.
Looks good
Fix #12520
Summary of the changes
ListPartSettings
that would allow the user to show the container header across all pages like the navigation-bar does.Below are some screenshots of the changes this PR introduces. To demonstrate this I created a content type called "Business" that has
ListPart
. TheListPartSettings
contains "Business Location" and "Business Contact" as content types.A new navigation buttons that appear on every page where
PageListPart
orContainedPart
are used for easier navigationList Items view
Adding a new contained item "Business Location"
Editing a contained item "Business #11420
Editing the container it self "Edit Business"
New "ListPart Settings" to show the container's header
Here are screenshots with the Profile Header enabled
List Items view
Adding a new contained item "Business Location"
Editing a contained item "Business Location"
Editing the container it self "Edit Business"
The header is simple by default but you can override it using shape views.
Here is how one can override the view. In your theme, created a view
Content-Business.Header.cshtml
. My Custom view contains this codeAnd the out come look like this
Before the PR
This is how "List Items" view looked with no buttons on the top
This is how "Edit Business" view looked with no buttons on the top