From 8b8a8c0ccbf75331c81856d2b14575b159a4fd3f Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Sun, 11 Aug 2019 14:16:54 +0200 Subject: [PATCH] display docType alias in Nested Content property editor when necessary --- .../nestedcontent/nestedcontent.controller.js | 11 +++++++++++ .../nestedcontent/nestedcontent.doctypepicker.html | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js index 7ead8974d8..941ed2ce8f 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js @@ -57,10 +57,21 @@ ncResources.getContentTypes().then(function (docTypes) { $scope.model.docTypes = docTypes; + + // Count doctype name occurrences + var docTypeNameOccurrences = _.countBy(docTypes, 'name'); + console.info(docTypeNameOccurrences); // Populate document type tab dictionary + // And append alias to name if multiple doctypes have the same name docTypes.forEach(function (value) { $scope.docTypeTabs[value.alias] = value.tabs; + + value.displayName = value.name; + + if (docTypeNameOccurrences[value.name] > 1) { + value.displayName += " (" + value.alias + ")"; + } }); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.doctypepicker.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.doctypepicker.html index 6aa1d8f12d..c4716ce216 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.doctypepicker.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.doctypepicker.html @@ -23,7 +23,7 @@