From 7cc9747b2f58fdc98445636fe85d80f84cf7a569 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Tue, 23 Apr 2019 21:31:48 +0200 Subject: [PATCH] V8: Allow content to be shown before list view (#5074) --- .../ContentApps/ContentEditorContentAppFactory.cs | 2 +- src/Umbraco.Web/ContentApps/ListViewContentAppFactory.cs | 7 +++++++ src/Umbraco.Web/PropertyEditors/ListViewConfiguration.cs | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web/ContentApps/ContentEditorContentAppFactory.cs b/src/Umbraco.Web/ContentApps/ContentEditorContentAppFactory.cs index 9d186b02f8..da7dbee364 100644 --- a/src/Umbraco.Web/ContentApps/ContentEditorContentAppFactory.cs +++ b/src/Umbraco.Web/ContentApps/ContentEditorContentAppFactory.cs @@ -9,7 +9,7 @@ namespace Umbraco.Web.ContentApps internal class ContentEditorContentAppFactory : IContentAppFactory { // see note on ContentApp - private const int Weight = -100; + internal const int Weight = -100; private ContentApp _contentApp; private ContentApp _mediaApp; diff --git a/src/Umbraco.Web/ContentApps/ListViewContentAppFactory.cs b/src/Umbraco.Web/ContentApps/ListViewContentAppFactory.cs index 7421a55907..ab605c7014 100644 --- a/src/Umbraco.Web/ContentApps/ListViewContentAppFactory.cs +++ b/src/Umbraco.Web/ContentApps/ListViewContentAppFactory.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.Models.ContentEditing; using Umbraco.Core.Models.Membership; @@ -99,6 +100,12 @@ namespace Umbraco.Web.ContentApps if (configTabName != null && String.IsNullOrWhiteSpace(configTabName.ToString()) == false) contentApp.Name = configTabName.ToString(); } + // if the list view is configured to show umbContent first, update the list view content app weight accordingly + if(listViewConfig.ContainsKey("showContentFirst") && + listViewConfig["showContentFirst"]?.ToString().TryConvertTo().Result == true) + { + contentApp.Weight = ContentEditorContentAppFactory.Weight + 1; + } //This is the view model used for the list view app contentApp.ViewModel = new List diff --git a/src/Umbraco.Web/PropertyEditors/ListViewConfiguration.cs b/src/Umbraco.Web/PropertyEditors/ListViewConfiguration.cs index bcddc18369..4f854a7556 100644 --- a/src/Umbraco.Web/PropertyEditors/ListViewConfiguration.cs +++ b/src/Umbraco.Web/PropertyEditors/ListViewConfiguration.cs @@ -63,6 +63,9 @@ namespace Umbraco.Web.PropertyEditors [ConfigurationField("tabName", "Content app name", "textstring", Description = "The name of the listview content app (default if empty: 'Child Items')")] public string TabName { get; set; } + [ConfigurationField("showContentFirst", "Show Content App First", "boolean", Description = "Enable this to show the content app by default instead of the list view app")] + public bool ShowContentFirst { get; set; } + public class Property { [JsonProperty("alias")]