From dec44b1288569c0674a98e6cc9a8a7cfb6ea9876 Mon Sep 17 00:00:00 2001 From: Robert Date: Tue, 26 Sep 2017 09:20:38 +0200 Subject: [PATCH 01/12] Moved templateConfig to root node --- .../ContentEditing/ContentItemDisplay.cs | 3 +++ .../Models/Mapping/ContentModelMapper.cs | 25 ++++++++++++------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs b/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs index 5d424e4dd3..197f5e88d1 100644 --- a/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs +++ b/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs @@ -28,6 +28,9 @@ namespace Umbraco.Web.Models.ContentEditing [DataMember(Name = "template")] public string TemplateAlias { get; set; } + + [DataMember(Name = "allowedTemplates")] + public object TemplateConfig { get; set; } [DataMember(Name = "urls")] public string[] Urls { get; set; } diff --git a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs index 1809bffd3d..68448ba4de 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs @@ -38,6 +38,7 @@ namespace Umbraco.Web.Models.Mapping .ForMember(display => display.Trashed, expression => expression.MapFrom(content => content.Trashed)) .ForMember(display => display.PublishDate, expression => expression.MapFrom(content => GetPublishedDate(content))) .ForMember(display => display.TemplateAlias, expression => expression.MapFrom(content => content.Template.Alias)) + .ForMember(display => display.TemplateConfig, expression => expression.ResolveUsing(content => AvailableTemplates(content, applicationContext.Services.TextService))) .ForMember(display => display.HasPublishedVersion, expression => expression.MapFrom(content => content.HasPublishedVersion)) .ForMember(display => display.Urls, expression => expression.MapFrom(content => @@ -106,14 +107,6 @@ namespace Umbraco.Web.Models.Mapping display.TreeNodeUrl = url; } - //fill in the template config to be passed to the template drop down. - var templateItemConfig = new Dictionary {{"", localizedText.Localize("general/choose")}}; - foreach (var t in content.ContentType.AllowedTemplates - .Where(t => t.Alias.IsNullOrWhiteSpace() == false && t.Name.IsNullOrWhiteSpace() == false)) - { - templateItemConfig.Add(t.Alias, t.Name); - } - if (content.ContentType.IsContainer) { TabsAndPropertiesResolver.AddListView(display, "content", dataTypeService, localizedText); @@ -162,7 +155,7 @@ namespace Umbraco.Web.Models.Mapping View = "dropdown", //TODO: Hard coding until we make a real dropdown property editor to lookup Config = new Dictionary { - {"items", templateItemConfig} + {"items", ""} } } }; @@ -245,5 +238,19 @@ namespace Umbraco.Web.Models.Mapping return permissions; } } + + + private static Dictionary AvailableTemplates(IContent content, ILocalizedTextService localizedText) + { + //fill in the template config to be passed to the template drop down. + var templateItemConfig = new Dictionary { { "", localizedText.Localize("general/choose") } }; + foreach (var t in content.ContentType.AllowedTemplates + .Where(t => t.Alias.IsNullOrWhiteSpace() == false && t.Name.IsNullOrWhiteSpace() == false)) + { + templateItemConfig.Add(t.Alias, t.Name); + } + + return templateItemConfig; + } } } \ No newline at end of file From e740838ef79d86796f39da02bd4f23f35d96b037 Mon Sep 17 00:00:00 2001 From: Robert Date: Tue, 26 Sep 2017 15:44:41 +0200 Subject: [PATCH 02/12] Moved template and docType from properties tab to root node and linked the values back together in front-end --- .../content/umbcontentnodeinfo.directive.js | 38 +-------- .../ContentEditing/ContentItemDisplay.cs | 7 +- .../Models/Mapping/ContentModelMapper.cs | 83 ++++++++++--------- 3 files changed, 50 insertions(+), 78 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js index 5f9917a018..fea44d126b 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js @@ -27,10 +27,10 @@ }; // get available templates - scope.availableTemplates = getAvailableTemplates(scope.node); + scope.availableTemplates = scope.node.allowedTemplates.items; // get document type details - scope.documentType = getDocumentType(scope.node); + scope.documentType = scope.node.docTypeValue[0]; loadAuditTrail(); @@ -111,40 +111,6 @@ }); } - function getAvailableTemplates(node) { - - var availableTemplates = {}; - - // find the templates in the properties array - angular.forEach(node.properties, function (property) { - if (property.alias === "_umb_template") { - if (property.config && property.config.items) { - availableTemplates = property.config.items; - } - } - }); - - return availableTemplates; - - } - - function getDocumentType(node) { - - var documentType = {}; - - // find the document type in the properties array - angular.forEach(node.properties, function (property) { - if (property.alias === "_umb_doctype") { - if (property.value && property.value.length > 0) { - documentType = property.value[0]; - } - } - }); - - return documentType; - - } - function setPublishDate(date) { // update publish value diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs b/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs index 197f5e88d1..23331a6ce0 100644 --- a/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs +++ b/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs @@ -29,8 +29,11 @@ namespace Umbraco.Web.Models.ContentEditing [DataMember(Name = "template")] public string TemplateAlias { get; set; } - [DataMember(Name = "allowedTemplates")] - public object TemplateConfig { get; set; } + [DataMember(Name = "allowedTemplates")] + public object AllowedTemplates { get; set; } + + [DataMember(Name = "docTypeValue")] + public object DocTypeValue { get; set; } [DataMember(Name = "urls")] public string[] Urls { get; set; } diff --git a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs index 68448ba4de..01a74baf74 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs @@ -38,12 +38,11 @@ namespace Umbraco.Web.Models.Mapping .ForMember(display => display.Trashed, expression => expression.MapFrom(content => content.Trashed)) .ForMember(display => display.PublishDate, expression => expression.MapFrom(content => GetPublishedDate(content))) .ForMember(display => display.TemplateAlias, expression => expression.MapFrom(content => content.Template.Alias)) - .ForMember(display => display.TemplateConfig, expression => expression.ResolveUsing(content => AvailableTemplates(content, applicationContext.Services.TextService))) .ForMember(display => display.HasPublishedVersion, expression => expression.MapFrom(content => content.HasPublishedVersion)) .ForMember(display => display.Urls, expression => expression.MapFrom(content => UmbracoContext.Current == null - ? new[] {"Cannot generate urls without a current Umbraco Context"} + ? new[] { "Cannot generate urls without a current Umbraco Context" } : content.GetContentUrls(UmbracoContext.Current))) .ForMember(display => display.Properties, expression => expression.Ignore()) .ForMember(display => display.AllowPreview, expression => expression.Ignore()) @@ -107,20 +106,22 @@ namespace Umbraco.Web.Models.Mapping display.TreeNodeUrl = url; } + //fill in the template config to be passed to the template drop down. + var templateItemConfig = new Dictionary { { "", localizedText.Localize("general/choose") } }; + foreach (var t in content.ContentType.AllowedTemplates + .Where(t => t.Alias.IsNullOrWhiteSpace() == false && t.Name.IsNullOrWhiteSpace() == false)) + { + templateItemConfig.Add(t.Alias, t.Name); + } + + if (content.ContentType.IsContainer) { TabsAndPropertiesResolver.AddListView(display, "content", dataTypeService, localizedText); } var properties = new List - { - new ContentPropertyDisplay - { - Alias = string.Format("{0}doctype", Constants.PropertyEditors.InternalGenericPropertiesPrefix), - Label = localizedText.Localize("content/documentType"), - Value = localizedText.UmbracoDictionaryTranslate(display.ContentTypeName), - View = PropertyEditorResolver.Current.GetByAlias(Constants.PropertyEditors.NoEditAlias).ValueEditor.View - }, + { new ContentPropertyDisplay { Alias = string.Format("{0}releasedate", Constants.PropertyEditors.InternalGenericPropertiesPrefix), @@ -147,17 +148,7 @@ namespace Umbraco.Web.Models.Mapping } //TODO: Fix up hard coded datepicker }, - new ContentPropertyDisplay - { - Alias = string.Format("{0}template", Constants.PropertyEditors.InternalGenericPropertiesPrefix), - Label = localizedText.Localize("template/template"), - Value = display.TemplateAlias, - View = "dropdown", //TODO: Hard coding until we make a real dropdown property editor to lookup - Config = new Dictionary - { - {"items", ""} - } - } + }; @@ -177,8 +168,30 @@ namespace Umbraco.Web.Models.Mapping //TODO: Hard coding this is not good var docTypeLink = string.Format("#/settings/documenttypes/edit/{0}", currentDocumentTypeId); + var templateProperty = new ContentPropertyDisplay + { + Alias = string.Format("{0}template", + Constants.PropertyEditors.InternalGenericPropertiesPrefix), + Label = localizedText.Localize("template/template"), + Value = display.TemplateAlias, + View = + "dropdown", //TODO: Hard coding until we make a real dropdown property editor to lookup + Config = new Dictionary + { + {"items", templateItemConfig} + } + }; + //Replace the doc type property - var docTypeProperty = genericProperties.First(x => x.Alias == string.Format("{0}doctype", Constants.PropertyEditors.InternalGenericPropertiesPrefix)); + var docTypeProperty = new ContentPropertyDisplay + { + Alias = string.Format("{0}doctype", + Constants.PropertyEditors.InternalGenericPropertiesPrefix), + Label = localizedText.Localize("content/documentType"), + Value = localizedText.UmbracoDictionaryTranslate(display.ContentTypeName), + View = PropertyEditorResolver.Current.GetByAlias(Constants.PropertyEditors.NoEditAlias) + .ValueEditor.View + }; docTypeProperty.Value = new List { new @@ -190,10 +203,14 @@ namespace Umbraco.Web.Models.Mapping } }; //TODO: Hard coding this because the templatepicker doesn't necessarily need to be a resolvable (real) property editor - docTypeProperty.View = "urllist"; - } - - // inject 'Link to document' as the first generic property + docTypeProperty.View = "urllist"; + + //Moving template and docType properties to the root node (issue U4-10311) + display.AllowedTemplates = templateProperty.Config; + display.DocTypeValue = docTypeProperty.Value; + } + + // inject 'Link to document' as the first generic property genericProperties.Insert(0, new ContentPropertyDisplay { Alias = string.Format("{0}urls", Constants.PropertyEditors.InternalGenericPropertiesPrefix), @@ -238,19 +255,5 @@ namespace Umbraco.Web.Models.Mapping return permissions; } } - - - private static Dictionary AvailableTemplates(IContent content, ILocalizedTextService localizedText) - { - //fill in the template config to be passed to the template drop down. - var templateItemConfig = new Dictionary { { "", localizedText.Localize("general/choose") } }; - foreach (var t in content.ContentType.AllowedTemplates - .Where(t => t.Alias.IsNullOrWhiteSpace() == false && t.Name.IsNullOrWhiteSpace() == false)) - { - templateItemConfig.Add(t.Alias, t.Name); - } - - return templateItemConfig; - } } } \ No newline at end of file From 67edc6cf9a781b1d270b3c4c7bbed71222b569e4 Mon Sep 17 00:00:00 2001 From: Robert Date: Tue, 26 Sep 2017 15:57:50 +0200 Subject: [PATCH 03/12] Deleted updateDate, createDate and createdBy from properties tab --- .../Mapping/TabsAndPropertiesResolver.cs | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs index 1722eecf79..383373f465 100644 --- a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs @@ -71,30 +71,6 @@ namespace Umbraco.Web.Models.Mapping Value = Convert.ToInt32(display.Id).ToInvariantString() + "
" + display.Key + "", View = labelEditor }, - new ContentPropertyDisplay - { - Alias = string.Format("{0}creator", Constants.PropertyEditors.InternalGenericPropertiesPrefix), - Label = localizedTextService.Localize("content/createBy"), - Description = localizedTextService.Localize("content/createByDesc"), - Value = display.Owner.Name, - View = labelEditor - }, - new ContentPropertyDisplay - { - Alias = string.Format("{0}createdate", Constants.PropertyEditors.InternalGenericPropertiesPrefix), - Label = localizedTextService.Localize("content/createDate"), - Description = localizedTextService.Localize("content/createDateDesc"), - Value = display.CreateDate.ToIsoString(), - View = labelEditor - }, - new ContentPropertyDisplay - { - Alias = string.Format("{0}updatedate", Constants.PropertyEditors.InternalGenericPropertiesPrefix), - Label = localizedTextService.Localize("content/updateDate"), - Description = localizedTextService.Localize("content/updateDateDesc"), - Value = display.UpdateDate.ToIsoString(), - View = labelEditor - } }; if (customProperties != null) From 4a9e32626747f5bc7ef21d89eb3e1a45c6bb4142 Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 27 Sep 2017 09:28:51 +0200 Subject: [PATCH 04/12] Remove the rest of umb properties --- .../Models/Mapping/ContentModelMapper.cs | 61 ++++++++----------- .../Mapping/TabsAndPropertiesResolver.cs | 8 +-- 2 files changed, 27 insertions(+), 42 deletions(-) diff --git a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs index 01a74baf74..44f8448608 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs @@ -122,32 +122,32 @@ namespace Umbraco.Web.Models.Mapping var properties = new List { - 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 - { - {"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 - { - {"offsetTime", "1"} - } - //TODO: Fix up hard coded datepicker - }, + //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 + // { + // {"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 + // { + // {"offsetTime", "1"} + // } + // //TODO: Fix up hard coded datepicker + //}, }; @@ -209,15 +209,6 @@ namespace Umbraco.Web.Models.Mapping display.AllowedTemplates = templateProperty.Config; display.DocTypeValue = docTypeProperty.Value; } - - // inject 'Link to document' as the first generic property - genericProperties.Insert(0, new ContentPropertyDisplay - { - Alias = string.Format("{0}urls", Constants.PropertyEditors.InternalGenericPropertiesPrefix), - Label = localizedText.Localize("content/urls"), - Value = string.Join(",", display.Urls), - View = "urllist" //TODO: Hard coding this because the templatepicker doesn't necessarily need to be a resolvable (real) property editor - }); }); } diff --git a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs index 383373f465..3e0fcadfd4 100644 --- a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs @@ -64,13 +64,7 @@ namespace Umbraco.Web.Models.Mapping var contentProps = new List { - new ContentPropertyDisplay - { - Alias = string.Format("{0}id", Constants.PropertyEditors.InternalGenericPropertiesPrefix), - Label = "Id", - Value = Convert.ToInt32(display.Id).ToInvariantString() + "
" + display.Key + "", - View = labelEditor - }, + }; if (customProperties != null) From eb7f4e74f29ee81c41f287d57f6c4598d8c1654c Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 27 Sep 2017 09:31:31 +0200 Subject: [PATCH 05/12] Removed unused code as we dont have those properties in the properties tab anymore --- .../content/umbcontentnodeinfo.directive.js | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js index fea44d126b..610ba6fd3f 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js @@ -116,15 +116,6 @@ // update publish value scope.node.releaseDate = date; - // update template value on the correct tab - angular.forEach(scope.node.tabs, function (tab) { - angular.forEach(tab.properties, function (property) { - if (property.alias === "_umb_releasedate") { - property.value = date; - } - }); - }); - // emit event var args = { node: scope.node, date: date }; eventsService.emit("editors.content.changePublishDate", args); @@ -136,15 +127,6 @@ // update publish value scope.node.releaseDate = null; - // update template value on the correct tab - angular.forEach(scope.node.tabs, function (tab) { - angular.forEach(tab.properties, function (property) { - if (property.alias === "_umb_releasedate") { - property.value = null; - } - }); - }); - // emit event var args = { node: scope.node, date: null }; eventsService.emit("editors.content.changePublishDate", args); From 98b4aa6bae3dcafdefc1d3e3379289467fb4241d Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 27 Sep 2017 10:56:45 +0200 Subject: [PATCH 06/12] Cleared more of the not needed code --- .../content/umbcontentnodeinfo.directive.js | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js index 610ba6fd3f..25a9d986aa 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js @@ -52,15 +52,6 @@ // update template value scope.node.template = templateAlias; - // update template value on the correct tab - angular.forEach(scope.node.tabs, function (tab) { - angular.forEach(tab.properties, function (property) { - if (property.alias === "_umb_template") { - property.value = templateAlias; - } - }); - }); - }; scope.datePickerChange = function (event, type) { @@ -138,15 +129,6 @@ // update publish value scope.node.removeDate = date; - // update template value on the correct tab - angular.forEach(scope.node.tabs, function (tab) { - angular.forEach(tab.properties, function (property) { - if (property.alias === "_umb_expiredate") { - property.value = date; - } - }); - }); - // emit event var args = { node: scope.node, date: date }; eventsService.emit("editors.content.changeUnpublishDate", args); @@ -158,15 +140,6 @@ // update publish value scope.node.removeDate = null; - // update template value on the correct tab - angular.forEach(scope.node.tabs, function (tab) { - angular.forEach(tab.properties, function (property) { - if (property.alias === "_umb_expiredate") { - property.value = null; - } - }); - }); - // emit event var args = { node: scope.node, date: null }; eventsService.emit("editors.content.changeUnpublishDate", args); From fe97860694e8038b86c4930b436dc1500ed9e047 Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 27 Sep 2017 11:56:11 +0200 Subject: [PATCH 07/12] Changed dataFormatter to work with values from the root node instead of values from properties tab --- .../services/umbdataformatter.service.js | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/services/umbdataformatter.service.js b/src/Umbraco.Web.UI.Client/src/common/services/umbdataformatter.service.js index 5fc2416927..6efd6ef4e3 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/umbdataformatter.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/umbdataformatter.service.js @@ -324,22 +324,13 @@ //this is basically the same as for media but we need to explicitly add some extra properties var saveModel = this.formatMediaPostData(displayModel, action); - var genericTab = _.find(displayModel.tabs, function (item) { - return item.id === 0; - }); - - var propExpireDate = _.find(genericTab.properties, function (item) { - return item.alias === "_umb_expiredate"; - }); - var propReleaseDate = _.find(genericTab.properties, function (item) { - return item.alias === "_umb_releasedate"; - }); - var propTemplate = _.find(genericTab.properties, function (item) { - return item.alias === "_umb_template"; - }); - saveModel.expireDate = propExpireDate ? propExpireDate.value : null; - saveModel.releaseDate = propReleaseDate ? propReleaseDate.value : null; - saveModel.templateAlias = propTemplate ? propTemplate.value : null; + var propExpireDate = displayModel.removeDate; + var propReleaseDate = displayModel.releaseDate; + var propTemplate = displayModel.template; + + saveModel.expireDate = propExpireDate ? propExpireDate : null; + saveModel.releaseDate = propReleaseDate ? propReleaseDate : null; + saveModel.templateAlias = propTemplate ? propTemplate : null; return saveModel; } From 2e1e2e4325d40e655e1e38ecd1e2e315195ecff9 Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 27 Sep 2017 13:58:33 +0200 Subject: [PATCH 08/12] Properties tab will be removed if it has no properties --- .../Models/Mapping/ContentModelMapper.cs | 32 +-------------- .../Mapping/TabsAndPropertiesResolver.cs | 40 ++++++++++--------- 2 files changed, 22 insertions(+), 50 deletions(-) diff --git a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs index 44f8448608..1d187110a8 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs @@ -120,37 +120,7 @@ namespace Umbraco.Web.Models.Mapping TabsAndPropertiesResolver.AddListView(display, "content", dataTypeService, localizedText); } - var properties = new List - { - //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 - // { - // {"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 - // { - // {"offsetTime", "1"} - // } - // //TODO: Fix up hard coded datepicker - //}, - - }; - + var properties = new List(); TabsAndPropertiesResolver.MapGenericProperties(content, display, localizedText, properties.ToArray(), genericProperties => diff --git a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs index 3e0fcadfd4..b5f219a072 100644 --- a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs @@ -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 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 - { - - }; + var contentProps = new List(); 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); + } } /// @@ -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(TabbedContentItem display, + private static void SetChildItemsTabPosition(TabbedContentItem display, IDictionary listViewConfig, - Tab listViewTab) + Tab 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(); - - // merge properties for groups with the same name + var properties = new List(); + + // 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 { - Id = 0, - Label = _localizedTextService.Localize("general/properties"), + Id = 0, + Label = _localizedTextService.Localize("general/properties"), Alias = "Generic properties", Properties = genericproperties }); From 62cda02dedc9f84d1b98c101479b3acb7664ea75 Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 27 Sep 2017 16:02:32 +0200 Subject: [PATCH 09/12] Some clean up in ContentModelMapper.cs --- .../Models/Mapping/ContentModelMapper.cs | 116 +++++++++--------- .../Mapping/TabsAndPropertiesResolver.cs | 2 +- 2 files changed, 57 insertions(+), 61 deletions(-) diff --git a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs index 1d187110a8..330823be96 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs @@ -119,67 +119,63 @@ namespace Umbraco.Web.Models.Mapping { TabsAndPropertiesResolver.AddListView(display, "content", dataTypeService, localizedText); } - - var properties = new List(); - - TabsAndPropertiesResolver.MapGenericProperties(content, display, localizedText, properties.ToArray(), - genericProperties => - { - //TODO: This would be much nicer with the IUmbracoContextAccessor so we don't use singletons - //If this is a web request and there's a user signed in and the - // user has access to the settings section, we will - if (HttpContext.Current != null && UmbracoContext.Current != null && UmbracoContext.Current.Security.CurrentUser != null - && UmbracoContext.Current.Security.CurrentUser.AllowedSections.Any(x => x.Equals(Constants.Applications.Settings))) - { - var currentDocumentType = contentTypeService.GetContentType(display.ContentTypeAlias); - var currentDocumentTypeName = currentDocumentType == null ? string.Empty : localizedText.UmbracoDictionaryTranslate(currentDocumentType.Name); - - var currentDocumentTypeId = currentDocumentType == null ? string.Empty : currentDocumentType.Id.ToString(CultureInfo.InvariantCulture); - //TODO: Hard coding this is not good - var docTypeLink = string.Format("#/settings/documenttypes/edit/{0}", currentDocumentTypeId); - - var templateProperty = new ContentPropertyDisplay - { - Alias = string.Format("{0}template", - Constants.PropertyEditors.InternalGenericPropertiesPrefix), - Label = localizedText.Localize("template/template"), - Value = display.TemplateAlias, - View = - "dropdown", //TODO: Hard coding until we make a real dropdown property editor to lookup - Config = new Dictionary - { - {"items", templateItemConfig} - } - }; - - //Replace the doc type property - var docTypeProperty = new ContentPropertyDisplay - { - Alias = string.Format("{0}doctype", - Constants.PropertyEditors.InternalGenericPropertiesPrefix), - Label = localizedText.Localize("content/documentType"), - Value = localizedText.UmbracoDictionaryTranslate(display.ContentTypeName), - View = PropertyEditorResolver.Current.GetByAlias(Constants.PropertyEditors.NoEditAlias) - .ValueEditor.View - }; - docTypeProperty.Value = new List - { - new - { - linkText = currentDocumentTypeName, - url = docTypeLink, - target = "_self", - icon = "icon-item-arrangement" - } - }; - //TODO: Hard coding this because the templatepicker doesn't necessarily need to be a resolvable (real) property editor - docTypeProperty.View = "urllist"; - //Moving template and docType properties to the root node (issue U4-10311) - display.AllowedTemplates = templateProperty.Config; - display.DocTypeValue = docTypeProperty.Value; - } - }); + //TODO: This would be much nicer with the IUmbracoContextAccessor so we don't use singletons + //If this is a web request and there's a user signed in and the + // user has access to the settings section, we will + if (HttpContext.Current != null && UmbracoContext.Current != null && UmbracoContext.Current.Security.CurrentUser != null + && UmbracoContext.Current.Security.CurrentUser.AllowedSections.Any(x => x.Equals(Constants.Applications.Settings))) + { + var currentDocumentType = contentTypeService.GetContentType(display.ContentTypeAlias); + var currentDocumentTypeName = currentDocumentType == null ? string.Empty : localizedText.UmbracoDictionaryTranslate(currentDocumentType.Name); + + var currentDocumentTypeId = currentDocumentType == null ? string.Empty : currentDocumentType.Id.ToString(CultureInfo.InvariantCulture); + //TODO: Hard coding this is not good + var docTypeLink = string.Format("#/settings/documenttypes/edit/{0}", currentDocumentTypeId); + + var templateProperty = new ContentPropertyDisplay + { + Alias = string.Format("{0}template", + Constants.PropertyEditors.InternalGenericPropertiesPrefix), + Label = localizedText.Localize("template/template"), + Value = display.TemplateAlias, + View = + "dropdown", //TODO: Hard coding until we make a real dropdown property editor to lookup + Config = new Dictionary + { + {"items", templateItemConfig} + } + }; + + //Replace the doc type property + var docTypeProperty = new ContentPropertyDisplay + { + Alias = string.Format("{0}doctype", + Constants.PropertyEditors.InternalGenericPropertiesPrefix), + Label = localizedText.Localize("content/documentType"), + Value = localizedText.UmbracoDictionaryTranslate(display.ContentTypeName), + View = PropertyEditorResolver.Current.GetByAlias(Constants.PropertyEditors.NoEditAlias) + .ValueEditor.View + }; + docTypeProperty.Value = new List + { + new + { + linkText = currentDocumentTypeName, + url = docTypeLink, + target = "_self", + icon = "icon-item-arrangement" + } + }; + //TODO: Hard coding this because the templatepicker doesn't necessarily need to be a resolvable (real) property editor + docTypeProperty.View = "urllist"; + + //Moving template and docType properties to the root node (issue U4-10311) + display.AllowedTemplates = templateProperty.Config; + display.DocTypeValue = docTypeProperty.Value; + } + + TabsAndPropertiesResolver.MapGenericProperties(content, display, localizedText); } /// diff --git a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs index b5f219a072..f49c2893b8 100644 --- a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs @@ -81,7 +81,7 @@ namespace Umbraco.Web.Models.Mapping //re-assign genericProps.Properties = contentProps; - //Show or hide properties tab if it has any properties + //Show or hide properties tab based on wether it has or not any properties if (genericProps.Properties.Any() == false) { display.Tabs = display.Tabs.Where(x => x.Id != 0); From 387faca71e70179bc6c8635259bfb356a0c5ba19 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 28 Sep 2017 14:54:18 +1000 Subject: [PATCH 10/12] Simplifies the model mapping, uses strongly typed values --- .../content/umbcontentnodeinfo.directive.js | 2 +- .../ContentEditing/ContentItemDisplay.cs | 7 +- .../Models/Mapping/ContentModelMapper.cs | 98 ++++++------------- 3 files changed, 35 insertions(+), 72 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js index 25a9d986aa..7fb83da0c9 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js @@ -30,7 +30,7 @@ scope.availableTemplates = scope.node.allowedTemplates.items; // get document type details - scope.documentType = scope.node.docTypeValue[0]; + scope.documentType = scope.node.documentType; loadAuditTrail(); diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs b/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs index 23331a6ce0..d0194ac009 100644 --- a/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs +++ b/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs @@ -5,7 +5,6 @@ using Umbraco.Core.Models; namespace Umbraco.Web.Models.ContentEditing { - /// /// A model representing a content item to be displayed in the back office /// @@ -30,10 +29,10 @@ namespace Umbraco.Web.Models.ContentEditing public string TemplateAlias { get; set; } [DataMember(Name = "allowedTemplates")] - public object AllowedTemplates { get; set; } + public IDictionary AllowedTemplates { get; set; } - [DataMember(Name = "docTypeValue")] - public object DocTypeValue { get; set; } + [DataMember(Name = "documentType")] + public ContentTypeBasic DocumentType { get; set; } [DataMember(Name = "urls")] public string[] Urls { get; set; } diff --git a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs index 330823be96..9741a2cff4 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs @@ -14,6 +14,7 @@ using Umbraco.Web.Trees; using Umbraco.Web.Routing; using umbraco.BusinessLogic.Actions; using Umbraco.Core.PropertyEditors; +using Content = Umbraco.Core.Models.Content; namespace Umbraco.Web.Models.Mapping { @@ -42,7 +43,7 @@ namespace Umbraco.Web.Models.Mapping .ForMember(display => display.Urls, expression => expression.MapFrom(content => UmbracoContext.Current == null - ? new[] { "Cannot generate urls without a current Umbraco Context" } + ? new[] {"Cannot generate urls without a current Umbraco Context"} : content.GetContentUrls(UmbracoContext.Current))) .ForMember(display => display.Properties, expression => expression.Ignore()) .ForMember(display => display.AllowPreview, expression => expression.Ignore()) @@ -50,6 +51,11 @@ namespace Umbraco.Web.Models.Mapping .ForMember(display => display.Notifications, expression => expression.Ignore()) .ForMember(display => display.Errors, expression => expression.Ignore()) .ForMember(display => display.Alias, expression => expression.Ignore()) + .ForMember(display => display.DocumentType, expression => expression.ResolveUsing()) + .ForMember(display => display.AllowedTemplates, expression => + expression.MapFrom(content => content.ContentType.AllowedTemplates + .Where(t => t.Alias.IsNullOrWhiteSpace() == false && t.Name.IsNullOrWhiteSpace() == false) + .ToDictionary(t => t.Alias, t => t.Name))) .ForMember(display => display.Tabs, expression => expression.ResolveUsing(new TabsAndPropertiesResolver(applicationContext.Services.TextService))) .ForMember(display => display.AllowedActions, expression => expression.ResolveUsing( new ActionButtonsResolver(new Lazy(() => applicationContext.Services.UserService)))) @@ -105,78 +111,36 @@ namespace Umbraco.Web.Models.Mapping var url = urlHelper.GetUmbracoApiService(controller => controller.GetTreeNode(display.Id.ToString(), null)); display.TreeNodeUrl = url; } - - //fill in the template config to be passed to the template drop down. - var templateItemConfig = new Dictionary { { "", localizedText.Localize("general/choose") } }; - foreach (var t in content.ContentType.AllowedTemplates - .Where(t => t.Alias.IsNullOrWhiteSpace() == false && t.Name.IsNullOrWhiteSpace() == false)) - { - templateItemConfig.Add(t.Alias, t.Name); - } - - + if (content.ContentType.IsContainer) { TabsAndPropertiesResolver.AddListView(display, "content", dataTypeService, localizedText); - } - - //TODO: This would be much nicer with the IUmbracoContextAccessor so we don't use singletons - //If this is a web request and there's a user signed in and the - // user has access to the settings section, we will - if (HttpContext.Current != null && UmbracoContext.Current != null && UmbracoContext.Current.Security.CurrentUser != null - && UmbracoContext.Current.Security.CurrentUser.AllowedSections.Any(x => x.Equals(Constants.Applications.Settings))) - { - var currentDocumentType = contentTypeService.GetContentType(display.ContentTypeAlias); - var currentDocumentTypeName = currentDocumentType == null ? string.Empty : localizedText.UmbracoDictionaryTranslate(currentDocumentType.Name); + } - var currentDocumentTypeId = currentDocumentType == null ? string.Empty : currentDocumentType.Id.ToString(CultureInfo.InvariantCulture); - //TODO: Hard coding this is not good - var docTypeLink = string.Format("#/settings/documenttypes/edit/{0}", currentDocumentTypeId); - - var templateProperty = new ContentPropertyDisplay - { - Alias = string.Format("{0}template", - Constants.PropertyEditors.InternalGenericPropertiesPrefix), - Label = localizedText.Localize("template/template"), - Value = display.TemplateAlias, - View = - "dropdown", //TODO: Hard coding until we make a real dropdown property editor to lookup - Config = new Dictionary - { - {"items", templateItemConfig} - } - }; - - //Replace the doc type property - var docTypeProperty = new ContentPropertyDisplay - { - Alias = string.Format("{0}doctype", - Constants.PropertyEditors.InternalGenericPropertiesPrefix), - Label = localizedText.Localize("content/documentType"), - Value = localizedText.UmbracoDictionaryTranslate(display.ContentTypeName), - View = PropertyEditorResolver.Current.GetByAlias(Constants.PropertyEditors.NoEditAlias) - .ValueEditor.View - }; - docTypeProperty.Value = new List - { - new - { - linkText = currentDocumentTypeName, - url = docTypeLink, - target = "_self", - icon = "icon-item-arrangement" - } - }; - //TODO: Hard coding this because the templatepicker doesn't necessarily need to be a resolvable (real) property editor - docTypeProperty.View = "urllist"; - - //Moving template and docType properties to the root node (issue U4-10311) - display.AllowedTemplates = templateProperty.Config; - display.DocTypeValue = docTypeProperty.Value; - } - TabsAndPropertiesResolver.MapGenericProperties(content, display, localizedText); } + + /// + /// Resolves a from the item and checks if the current user + /// has access to see this data + /// + private class ContentTypeBasicResolver : ValueResolver + { + protected override ContentTypeBasic ResolveCore(IContent source) + { + //TODO: This would be much nicer with the IUmbracoContextAccessor so we don't use singletons + //If this is a web request and there's a user signed in and the + // user has access to the settings section, we will + if (HttpContext.Current != null && UmbracoContext.Current != null && UmbracoContext.Current.Security.CurrentUser != null + && UmbracoContext.Current.Security.CurrentUser.AllowedSections.Any(x => x.Equals(Constants.Applications.Settings))) + { + var contentTypeBasic = Mapper.Map(source.ContentType); + return contentTypeBasic; + } + //no access + return null; + } + } /// /// Creates the list of action buttons allowed for this user - Publish, Send to publish, save, unpublish returned as the button's 'letter' From 252f0fe88e9bef9f16f6c738a8699f75b0ac4be7 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 28 Sep 2017 15:13:33 +1000 Subject: [PATCH 11/12] Fixes up the angular side of things to ensure the right property values are wired together correctly --- .../components/content/umbcontentnodeinfo.directive.js | 7 +++---- .../views/components/content/umb-content-node-info.html | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js index 7fb83da0c9..dd1cd77e2e 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js @@ -27,7 +27,7 @@ }; // get available templates - scope.availableTemplates = scope.node.allowedTemplates.items; + scope.availableTemplates = scope.node.allowedTemplates; // get document type details scope.documentType = scope.node.documentType; @@ -41,9 +41,8 @@ loadAuditTrail(); }; - scope.openDocumentType = function (documentType) { - // remove first "#" from url if it is prefixed else the path won't work - var url = documentType.url.replace(/^#/, ""); + scope.openDocumentType = function (documentType) { + var url = "/settings/documenttypes/edit/" + documentType.id; $location.path(url); }; diff --git a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-content-node-info.html b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-content-node-info.html index f1a62efe44..a64cd801d6 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-content-node-info.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-content-node-info.html @@ -165,7 +165,7 @@ @@ -177,6 +177,7 @@ ng-model="node.template" ng-options="key as value for (key, value) in availableTemplates" ng-change="updateTemplate(node.template)"> + From f6be389f4fa8c5ac597983a150eca3732255de9a Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 28 Sep 2017 16:13:50 +1000 Subject: [PATCH 12/12] fixes tests --- .../Models/Mapping/ContentWebModelMappingTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs index 8119753c8b..b7fa65131f 100644 --- a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs +++ b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs @@ -121,8 +121,7 @@ namespace Umbraco.Tests.Models.Mapping { AssertDisplayProperty(result, p, ApplicationContext); } - Assert.AreEqual(content.PropertyGroups.Count(), result.Tabs.Count() - 1); - Assert.IsTrue(result.Tabs.Any(x => x.Label == ui.Text("general", "properties"))); + Assert.AreEqual(content.PropertyGroups.Count(), result.Tabs.Count()); Assert.IsTrue(result.Tabs.First().IsActive); Assert.IsTrue(result.Tabs.Except(new[] {result.Tabs.First()}).All(x => x.IsActive == false)); }