From 48c70604a9584259fc5189637ce5a902346104a8 Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 4 May 2018 13:42:33 +0200 Subject: [PATCH 1/6] Added localization for "Ready to publish?" publish overlay, added previously removed property which was still in use. --- .../common/directives/components/content/edit.controller.js | 6 ++---- .../src/views/components/overlays/umb-overlay.html | 2 +- src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml | 2 +- src/Umbraco.Web/PublishedCache/NuCache/Property.cs | 1 + 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js index 63bdb9c92e..da5ac5034f 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js @@ -304,7 +304,6 @@ //before we launch the dialog we want to execute all client side validations first if (formHelper.submitForm({ scope: $scope, action: "publish" })) { var dialog = { - title: "Ready to Publish?", //TODO: localize view: "publish", variants: $scope.content.variants, //set a model property for the dialog skipFormValidation: true, //when submitting the overlay form, skip any client side validation @@ -400,7 +399,7 @@ var target = null; var error = { headline: "Cannot automatically restore this item", content: "Use the Move menu item to move it manually" }; - if (data.length == 0) { + if (data.length === 0) { notificationsService.error(error.headline, "There is no 'restore' relation found for this node. Use the Move menu item to move it manually."); $scope.page.buttonRestore = "error"; return; @@ -408,7 +407,7 @@ relation = data[0]; - if (relation.parentId == -1) { + if (relation.parentId === -1) { target = { id: -1, name: "Root" }; moveNode(content, target); } else { @@ -465,7 +464,6 @@ $scope.editors[editorIndex].content = angular.copy($scope.content); $scope.editors[editorIndex].content.name = "What a variant"; // set selected variant on split view content - console.log($scope.editors[editorIndex].content.variants); angular.forEach($scope.editors[editorIndex].content.variants, function (variant) { if (variant.culture === selectedVariant.culture) { variant.current = true; diff --git a/src/Umbraco.Web.UI.Client/src/views/components/overlays/umb-overlay.html b/src/Umbraco.Web.UI.Client/src/views/components/overlays/umb-overlay.html index 14a7ebf006..4180219ded 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/overlays/umb-overlay.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/overlays/umb-overlay.html @@ -2,7 +2,7 @@
-

{{model.title}}

+

{{model.subtitle}}

diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml index b8df84ad25..f5b890bd8c 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml @@ -235,7 +235,7 @@ What languages would you like to publish? No languages available to be published. Published Languages. - + Ready to Publish? Create a new Content Template from '%0%' diff --git a/src/Umbraco.Web/PublishedCache/NuCache/Property.cs b/src/Umbraco.Web/PublishedCache/NuCache/Property.cs index 82dabeaba3..f2e3355750 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/Property.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/Property.cs @@ -34,6 +34,7 @@ namespace Umbraco.Web.PublishedCache.NuCache private CacheValues _cacheValues; private string _valuesCacheKey; + private string _recurseCacheKey; // initializes a published content property with no value public Property(PublishedPropertyType propertyType, PublishedContent content, IPublishedSnapshotAccessor publishedSnapshotAccessor, PropertyCacheLevel referenceCacheLevel = PropertyCacheLevel.Element) From c5de31cce3e5ba9895663386506c49fa816f2db0 Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 4 May 2018 13:44:04 +0200 Subject: [PATCH 2/6] Invariant property value should persist trough all variants of a content item --- .../Models/Mapping/ContentPropertyBasicConverter.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicConverter.cs b/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicConverter.cs index 10fec19b38..aec5c375d9 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicConverter.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicConverter.cs @@ -46,12 +46,17 @@ namespace Umbraco.Web.Models.Mapping editor = _propertyEditors[Constants.PropertyEditors.Aliases.NoEdit]; } - var culture = context.GetCulture(); + var culture = context.GetCulture(); if (culture == null && property.PropertyType.Variations == ContentVariation.CultureNeutral) { //a language Id needs to be set for a property type that can be varried by language throw new InvalidOperationException($"No languageId found in mapping operation when one is required for the culture neutral property type {property.PropertyType.Alias}"); + } + if (property.PropertyType.Variations == ContentVariation.InvariantNeutral) + { + culture = null; + } var result = new TDestination From cc7febcc6d25e8de81f39bc09539fa48af75cbf6 Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 4 May 2018 13:51:35 +0200 Subject: [PATCH 3/6] Allows variant content item to save while having a invariant property, also fixes not being able to save invariant content item with invariant property --- src/Umbraco.Core/Models/Property.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Umbraco.Core/Models/Property.cs b/src/Umbraco.Core/Models/Property.cs index 709c37daaa..7e53eb764a 100644 --- a/src/Umbraco.Core/Models/Property.cs +++ b/src/Umbraco.Core/Models/Property.cs @@ -271,6 +271,10 @@ namespace Umbraco.Core.Models /// public void SetValue(object value, string culture = null, string segment = null) { + if (PropertyType.Variations == ContentVariation.InvariantNeutral) + { + culture = null; + } PropertyType.ValidateVariation(culture, segment, true); (var pvalue, var change) = GetPValue(culture, segment, true); From 1b2a964001a6cd61920d39f573819c62eb1a4930 Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 7 May 2018 12:08:59 +0200 Subject: [PATCH 4/6] Fixed localization --- .../common/directives/components/content/edit.controller.js | 3 ++- .../src/views/components/overlays/umb-overlay.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js index da5ac5034f..080e224b9d 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js @@ -4,7 +4,7 @@ function ContentEditController($rootScope, $scope, $routeParams, $q, $timeout, $window, $location, appState, contentResource, entityResource, navigationService, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, treeService, fileManager, formHelper, umbRequestHelper, - keyboardService, umbModelMapper, editorState, $http, eventsService, relationResource, overlayService) { + keyboardService, umbModelMapper, editorState, $http, eventsService, relationResource, overlayService, localizationService) { var evts = []; @@ -304,6 +304,7 @@ //before we launch the dialog we want to execute all client side validations first if (formHelper.submitForm({ scope: $scope, action: "publish" })) { var dialog = { + title: localizationService.localize("content_readyToPublish"), view: "publish", variants: $scope.content.variants, //set a model property for the dialog skipFormValidation: true, //when submitting the overlay form, skip any client side validation diff --git a/src/Umbraco.Web.UI.Client/src/views/components/overlays/umb-overlay.html b/src/Umbraco.Web.UI.Client/src/views/components/overlays/umb-overlay.html index 4180219ded..14a7ebf006 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/overlays/umb-overlay.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/overlays/umb-overlay.html @@ -2,7 +2,7 @@
-

+

{{model.title}}

{{model.subtitle}}

From 1a82f93722911c1d91fa68c92079703e0f3e5225 Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 7 May 2018 17:59:43 +0200 Subject: [PATCH 5/6] Fixes email property editor pre-value --- src/Umbraco.Web/PropertyEditors/EmailAddressConfiguration.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/PropertyEditors/EmailAddressConfiguration.cs b/src/Umbraco.Web/PropertyEditors/EmailAddressConfiguration.cs index de7756266f..4039a0e3a2 100644 --- a/src/Umbraco.Web/PropertyEditors/EmailAddressConfiguration.cs +++ b/src/Umbraco.Web/PropertyEditors/EmailAddressConfiguration.cs @@ -7,7 +7,7 @@ namespace Umbraco.Web.PropertyEditors /// public class EmailAddressConfiguration { - [ConfigurationField("Required?", "boolean")] + [ConfigurationField("IsRequired", "Required?", "boolean")] public bool IsRequired { get; set; } } -} \ No newline at end of file +} From 912d89cdb30c5f2a8a457675d5c649c66a2da1da Mon Sep 17 00:00:00 2001 From: Stephan Date: Mon, 7 May 2018 18:22:12 +0200 Subject: [PATCH 6/6] Fix DomainHelper --- .../Routing/DomainsAndCulturesTests.cs | 43 ++++++++++++++++++- src/Umbraco.Web/Routing/DomainHelper.cs | 6 ++- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Tests/Routing/DomainsAndCulturesTests.cs b/src/Umbraco.Tests/Routing/DomainsAndCulturesTests.cs index e4fcfc46f8..83b28ace25 100644 --- a/src/Umbraco.Tests/Routing/DomainsAndCulturesTests.cs +++ b/src/Umbraco.Tests/Routing/DomainsAndCulturesTests.cs @@ -3,6 +3,7 @@ using Moq; using NUnit.Framework; using Umbraco.Core.Models; using Umbraco.Tests.TestHelpers; +using Umbraco.Tests.Testing.Objects.Accessors; using Umbraco.Web.Routing; namespace Umbraco.Tests.Routing @@ -266,7 +267,7 @@ namespace Umbraco.Tests.Routing var globalSettings = Mock.Get(TestObjects.GetGlobalSettings()); //this will modify the IGlobalSettings instance stored in the container globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false); - SettingsForTests.ConfigureSettings(globalSettings.Object); + SettingsForTests.ConfigureSettings(globalSettings.Object); var umbracoContext = GetUmbracoContext(inputUrl, globalSettings:globalSettings.Object); var publishedRouter = CreatePublishedRouter(Container); @@ -316,7 +317,7 @@ namespace Umbraco.Tests.Routing var globalSettings = Mock.Get(TestObjects.GetGlobalSettings()); //this will modify the IGlobalSettings instance stored in the container globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false); - SettingsForTests.ConfigureSettings(globalSettings.Object); + SettingsForTests.ConfigureSettings(globalSettings.Object); var umbracoContext = GetUmbracoContext(inputUrl, globalSettings:globalSettings.Object); var publishedRouter = CreatePublishedRouter(Container); @@ -339,5 +340,43 @@ namespace Umbraco.Tests.Routing + + [Test] + public void WithDefaultCulture() + { + SetupDomainServiceMock(new[] + { + new UmbracoDomain("localhost:9000/en") + { + Id = 1, + LanguageId = LangEngId, + RootContentId = 10011, + LanguageIsoCode = "en-US" + }, + new UmbracoDomain("localhost:9000/fr") + { + Id = 1, + LanguageId = LangFrId, + RootContentId = 10012, + LanguageIsoCode = "fr-FR" + } + }); + + var requestUrl = "http://localhost:9000/fr/1001-2-2"; + + var defaultCultureAccessor = (TestDefaultCultureAccessor) DefaultCultureAccessor; + defaultCultureAccessor.DefaultCulture = "en-US"; + + var globalSettings = Mock.Get(TestObjects.GetGlobalSettings()); //this will modify the IGlobalSettings instance stored in the container + globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false); + SettingsForTests.ConfigureSettings(globalSettings.Object); + + var umbracoContext = GetUmbracoContext(requestUrl, globalSettings:globalSettings.Object); + var publishedRouter = CreatePublishedRouter(Container); + var publishedRequest = publishedRouter.CreateRequest(umbracoContext); + + var domain = publishedRouter.FindDomain(publishedRequest); + Assert.AreEqual("fr-FR", publishedRequest.Culture.Name); + } } } diff --git a/src/Umbraco.Web/Routing/DomainHelper.cs b/src/Umbraco.Web/Routing/DomainHelper.cs index 3d6d435179..16a3fc92ad 100644 --- a/src/Umbraco.Web/Routing/DomainHelper.cs +++ b/src/Umbraco.Web/Routing/DomainHelper.cs @@ -147,8 +147,10 @@ namespace Umbraco.Web.Routing // else we have a uri, // try to match that uri, else filter - // pick domains for cultures - var cultureDomains = SelectByCulture(domainsAndUris, culture, defaultCulture); + // if a culture is specified, then try to get domains for that culture + // (else cultureDomains will be null) + // do NOT specify a default culture, else it would pick those domains + var cultureDomains = SelectByCulture(domainsAndUris, culture, defaultCulture: null); IReadOnlyCollection considerForBaseDomains = domainsAndUris; if (cultureDomains != null) {