Properties tab will be removed if it has no properties
This commit is contained in:
@@ -120,37 +120,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
TabsAndPropertiesResolver.AddListView(display, "content", dataTypeService, localizedText);
|
||||
}
|
||||
|
||||
var properties = new List<ContentPropertyDisplay>
|
||||
{
|
||||
//new ContentPropertyDisplay
|
||||
//{
|
||||
// Alias = string.Format("{0}releasedate", Constants.PropertyEditors.InternalGenericPropertiesPrefix),
|
||||
// Label = localizedText.Localize("content/releaseDate"),
|
||||
// Value = display.ReleaseDate.HasValue ? display.ReleaseDate.Value.ToIsoString() : null,
|
||||
// //Not editible for people without publish permission (U4-287)
|
||||
// View = display.AllowedActions.Contains(ActionPublish.Instance.Letter.ToString(CultureInfo.InvariantCulture)) ? "datepicker" : PropertyEditorResolver.Current.GetByAlias(Constants.PropertyEditors.NoEditAlias).ValueEditor.View,
|
||||
// Config = new Dictionary<string, object>
|
||||
// {
|
||||
// {"offsetTime", "1"}
|
||||
// }
|
||||
// //TODO: Fix up hard coded datepicker
|
||||
//},
|
||||
//new ContentPropertyDisplay
|
||||
//{
|
||||
// Alias = string.Format("{0}expiredate", Constants.PropertyEditors.InternalGenericPropertiesPrefix),
|
||||
// Label = localizedText.Localize("content/unpublishDate"),
|
||||
// Value = display.ExpireDate.HasValue ? display.ExpireDate.Value.ToIsoString() : null,
|
||||
// //Not editible for people without publish permission (U4-287)
|
||||
// View = display.AllowedActions.Contains(ActionPublish.Instance.Letter.ToString(CultureInfo.InvariantCulture)) ? "datepicker" : PropertyEditorResolver.Current.GetByAlias(Constants.PropertyEditors.NoEditAlias).ValueEditor.View,
|
||||
// Config = new Dictionary<string, object>
|
||||
// {
|
||||
// {"offsetTime", "1"}
|
||||
// }
|
||||
// //TODO: Fix up hard coded datepicker
|
||||
//},
|
||||
|
||||
};
|
||||
|
||||
var properties = new List<ContentPropertyDisplay>();
|
||||
|
||||
TabsAndPropertiesResolver.MapGenericProperties(content, display, localizedText, properties.ToArray(),
|
||||
genericProperties =>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using AutoMapper;
|
||||
using Umbraco.Core;
|
||||
@@ -28,7 +29,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
|
||||
public TabsAndPropertiesResolver(ILocalizedTextService localizedTextService, IEnumerable<string> ignoreProperties)
|
||||
: this(localizedTextService)
|
||||
{
|
||||
{
|
||||
if (ignoreProperties == null) throw new ArgumentNullException("ignoreProperties");
|
||||
IgnoreProperties = ignoreProperties;
|
||||
}
|
||||
@@ -60,12 +61,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
//store the current props to append to the newly inserted ones
|
||||
var currProps = genericProps.Properties.ToArray();
|
||||
|
||||
var labelEditor = PropertyEditorResolver.Current.GetByAlias(Constants.PropertyEditors.NoEditAlias).ValueEditor.View;
|
||||
|
||||
var contentProps = new List<ContentPropertyDisplay>
|
||||
{
|
||||
|
||||
};
|
||||
var contentProps = new List<ContentPropertyDisplay>();
|
||||
|
||||
if (customProperties != null)
|
||||
{
|
||||
@@ -81,9 +77,15 @@ namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
onGenericPropertiesMapped(contentProps);
|
||||
}
|
||||
|
||||
//re-assign
|
||||
|
||||
//re-assign
|
||||
genericProps.Properties = contentProps;
|
||||
|
||||
//Show or hide properties tab if it has any properties
|
||||
if (genericProps.Properties.Any() == false)
|
||||
{
|
||||
display.Tabs = display.Tabs.Where(x => x.Id != 0);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -102,8 +104,8 @@ namespace Umbraco.Web.Models.Mapping
|
||||
switch (entityType)
|
||||
{
|
||||
case "content":
|
||||
dtdId = Constants.System.DefaultContentListViewDataTypeId;
|
||||
|
||||
dtdId = Constants.System.DefaultContentListViewDataTypeId;
|
||||
|
||||
break;
|
||||
case "media":
|
||||
dtdId = Constants.System.DefaultMediaListViewDataTypeId;
|
||||
@@ -116,7 +118,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
}
|
||||
|
||||
//first try to get the custom one if there is one
|
||||
var dt = dataTypeService.GetDataTypeDefinitionByName(customDtdName)
|
||||
var dt = dataTypeService.GetDataTypeDefinitionByName(customDtdName)
|
||||
?? dataTypeService.GetDataTypeDefinitionById(dtdId);
|
||||
|
||||
if (dt == null)
|
||||
@@ -165,9 +167,9 @@ namespace Umbraco.Web.Models.Mapping
|
||||
SetChildItemsTabPosition(display, listViewConfig, listViewTab);
|
||||
}
|
||||
|
||||
private static void SetChildItemsTabPosition<TPersisted>(TabbedContentItem<ContentPropertyDisplay, TPersisted> display,
|
||||
private static void SetChildItemsTabPosition<TPersisted>(TabbedContentItem<ContentPropertyDisplay, TPersisted> display,
|
||||
IDictionary<string, object> listViewConfig,
|
||||
Tab<ContentPropertyDisplay> listViewTab)
|
||||
Tab<ContentPropertyDisplay> listViewTab)
|
||||
where TPersisted : IContentBase
|
||||
{
|
||||
// Find position of tab from config
|
||||
@@ -207,9 +209,9 @@ namespace Umbraco.Web.Models.Mapping
|
||||
var groupsGroupsByName = content.PropertyGroups.OrderBy(x => x.SortOrder).GroupBy(x => x.Name);
|
||||
foreach (var groupsByName in groupsGroupsByName)
|
||||
{
|
||||
var properties = new List<Property>();
|
||||
|
||||
// merge properties for groups with the same name
|
||||
var properties = new List<Property>();
|
||||
|
||||
// merge properties for groups with the same name
|
||||
foreach (var group in groupsByName)
|
||||
{
|
||||
var groupProperties = content.GetPropertiesForGroup(group)
|
||||
@@ -251,8 +253,8 @@ namespace Umbraco.Web.Models.Mapping
|
||||
|
||||
tabs.Add(new Tab<ContentPropertyDisplay>
|
||||
{
|
||||
Id = 0,
|
||||
Label = _localizedTextService.Localize("general/properties"),
|
||||
Id = 0,
|
||||
Label = _localizedTextService.Localize("general/properties"),
|
||||
Alias = "Generic properties",
|
||||
Properties = genericproperties
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user