V8: Allow content to be shown before list view (#5074)

This commit is contained in:
Kenn Jacobsen
2019-04-23 21:31:48 +02:00
committed by Sebastiaan Janssen
parent 72d588287f
commit 7cc9747b2f
3 changed files with 11 additions and 1 deletions

View File

@@ -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;

View File

@@ -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<bool>().Result == true)
{
contentApp.Weight = ContentEditorContentAppFactory.Weight + 1;
}
//This is the view model used for the list view app
contentApp.ViewModel = new List<ContentPropertyDisplay>

View File

@@ -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")]