diff --git a/Build/DeloitteDigital.Atlas.NuGet.xml b/Build/DeloitteDigital.Atlas.NuGet.xml index 4675f32..4f1498a 100644 --- a/Build/DeloitteDigital.Atlas.NuGet.xml +++ b/Build/DeloitteDigital.Atlas.NuGet.xml @@ -6,7 +6,7 @@ ..\..\BuildOutputs - + diff --git a/Build/DeloitteDigital.Atlas.nuspec b/Build/DeloitteDigital.Atlas.nuspec index 717a6c0..4b4d26c 100644 --- a/Build/DeloitteDigital.Atlas.nuspec +++ b/Build/DeloitteDigital.Atlas.nuspec @@ -2,17 +2,21 @@ DeloitteDigital.Atlas - 1.1.0 + 2.3.20200611 Deloitte Digital Deloitte Digital - https://github.com/DeloitteDigitalAPAC/Atlas/blob/master/LICENSE + license\license.txt https://github.com/DeloitteDigitalAPAC/Atlas/ - https://raw.githubusercontent.com/DeloitteDigitalAPAC/Atlas/master/lib/logos/dd-logo-square.png + images\dd-logo-square.png + https://raw.githubusercontent.com/DeloitteDigitalAPAC/Atlas/master/lib/logos/dd-logo-square.png false Atlas is the Deloitte Digital Framework for Sitecore Development - sitecore deloitte atlas + Upgraded to Sitecore 9.3 and .NETFramework4.8 + sitecore deloitte experience accelerator atlas + + \ No newline at end of file diff --git a/DeloitteDigital.Atlas.sln b/DeloitteDigital.Atlas.sln index ace31fb..69484f1 100644 --- a/DeloitteDigital.Atlas.sln +++ b/DeloitteDigital.Atlas.sln @@ -1,14 +1,16 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29920.165 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeloitteDigital.Atlas", "src\DeloitteDigital.Atlas\DeloitteDigital.Atlas.csproj", "{601B96BD-D95F-4281-9A1B-7D99374DD869}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{170EAE52-10FD-4349-931B-6B48480DAF4E}" ProjectSection(SolutionItems) = preProject + Build\dd-logo-square.png = Build\dd-logo-square.png Build\DeloitteDigital.Atlas.NuGet.xml = Build\DeloitteDigital.Atlas.NuGet.xml Build\DeloitteDigital.Atlas.nuspec = Build\DeloitteDigital.Atlas.nuspec + Build\license.txt = Build\license.txt EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeloitteDigital.Atlas.Tests", "src\DeloitteDigital.Atlas.Tests\DeloitteDigital.Atlas.Tests.csproj", "{DC86FB1E-21B9-4D4B-8E61-40CEB8967F83}" @@ -31,4 +33,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C4120DCF-283D-4C71-A165-A67041EBB723} + EndGlobalSection EndGlobal diff --git a/Tools/nuget.exe b/Tools/nuget.exe index 8dd7e45..4cbab24 100644 Binary files a/Tools/nuget.exe and b/Tools/nuget.exe differ diff --git a/src/DeloitteDigital.Atlas.Tests/DeloitteDigital.Atlas.Tests.csproj b/src/DeloitteDigital.Atlas.Tests/DeloitteDigital.Atlas.Tests.csproj index 617a180..8cbeb40 100644 --- a/src/DeloitteDigital.Atlas.Tests/DeloitteDigital.Atlas.Tests.csproj +++ b/src/DeloitteDigital.Atlas.Tests/DeloitteDigital.Atlas.Tests.csproj @@ -8,7 +8,7 @@ Properties DeloitteDigital.Atlas.Tests DeloitteDigital.Atlas.Tests - v4.5.2 + v4.8 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10.0 @@ -35,147 +35,13 @@ prompt 4 - - - ..\..\packages\HtmlAgilityPack.1.4.6\lib\Net45\HtmlAgilityPack.dll - True - - - ..\..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - True - - - ..\..\packages\Lucene.Net.3.0.3\lib\NET40\Lucene.Net.dll - True - - - ..\..\packages\Microsoft.Extensions.DependencyInjection.1.0.0\lib\netstandard1.1\Microsoft.Extensions.DependencyInjection.dll - True - - - ..\..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.1.0.0\lib\netstandard1.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll - True - - - ..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - True - - - ..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll - True - - - ..\..\packages\Sitecore.Abstractions.8.2.160729\lib\NET452\Sitecore.Abstractions.dll - True - - - ..\..\packages\Sitecore.Analytics.8.2.160729\lib\NET452\Sitecore.Analytics.dll - True - - - ..\..\packages\Sitecore.Analytics.Core.8.2.160729\lib\NET452\Sitecore.Analytics.Core.dll - True - - - ..\..\packages\Sitecore.Analytics.DataAccess.8.2.160729\lib\NET452\Sitecore.Analytics.DataAccess.dll - True - - - ..\..\packages\Sitecore.Analytics.Model.8.2.160729\lib\NET452\Sitecore.Analytics.Model.dll - True - - - ..\..\packages\Sitecore.Analytics.Processing.8.2.160729\lib\NET452\Sitecore.Analytics.Processing.dll - True - - - ..\..\packages\Sitecore.FakeDb.1.3.1\lib\net45\Sitecore.FakeDb.dll - True - - - ..\..\packages\Sitecore.FakeDb.Serialization.1.3.1\lib\net45\Sitecore.FakeDb.Serialization.dll - True - - - ..\..\packages\Sitecore.Kernel.8.2.160729\lib\NET452\Sitecore.Kernel.dll - True - - - ..\..\packages\Sitecore.Logging.8.2.160729\lib\NET452\Sitecore.Logging.dll - True - - - ..\..\packages\Sitecore.Logging.Client.8.2.160729\lib\NET452\Sitecore.Logging.Client.dll - True - - - ..\..\packages\Sitecore.Marketing.8.2.160729\lib\NET452\Sitecore.Marketing.dll - True - - - ..\..\packages\Sitecore.Marketing.Core.8.2.160729\lib\NET452\Sitecore.Marketing.Core.dll - True - - - ..\..\packages\Sitecore.Marketing.Taxonomy.8.2.160729\lib\NET452\Sitecore.Marketing.Taxonomy.dll - True - - - ..\..\packages\Sitecore.Nexus.8.2.160729\lib\NET452\Sitecore.Nexus.dll - True - - - ..\..\packages\Sitecore.NVelocity.8.2.160729\lib\NET452\Sitecore.NVelocity.dll - True - - - ..\..\packages\Sitecore.Xdb.Configuration.8.2.160729\lib\NET452\Sitecore.Xdb.Configuration.dll - True - - - ..\..\packages\Sitecore.Zip.8.2.160729\lib\NET452\Sitecore.Zip.dll - True - - - - - ..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll - True - - - ..\..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll - True - - - ..\..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll - True - - - ..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll - True - - - ..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll - True - - - ..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll - True - - - - - - False - - - + @@ -188,10 +54,10 @@ - + Designer - - + Always + @@ -199,6 +65,29 @@ DeloitteDigital.Atlas + + + 3.0.2 + + + 9.3.0 + + + 3.0.0-alpha1 + + + 9.3.0 + + + 9.3.0 + + + 2.4.1 + + + + + diff --git a/src/DeloitteDigital.Atlas.Tests/FakeDB/DeserialisationTests.cs b/src/DeloitteDigital.Atlas.Tests/FakeDB/DeserialisationTests.cs index 4b7cfcc..17862c7 100644 --- a/src/DeloitteDigital.Atlas.Tests/FakeDB/DeserialisationTests.cs +++ b/src/DeloitteDigital.Atlas.Tests/FakeDB/DeserialisationTests.cs @@ -1,21 +1,21 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Shouldly; +using Xunit; namespace DeloitteDigital.Atlas.Tests.FakeDB { - [TestClass] public class DeserialisationTests { - [TestMethod] + [Fact] public void DeserialisationShouldReturnSitecoreItem() { using (var db = new DspFakeDb()) { var home = db.GetHomeItem(); - // ensure the de-serialisation worked - Assert.IsNotNull(home); - Assert.AreEqual("Home", home.Name); - Assert.AreEqual("Sitecore Experience Platform", home.Fields["Title"].ToString()); + // ensure the de-serialisation worked + home.ShouldNotBeNull(); + home.Name.ShouldBe("Home"); + home.Fields["Title"].ToString().ShouldBe("Sitecore Experience Platform"); } } diff --git a/src/DeloitteDigital.Atlas.Tests/ItemExtensionsTests.cs b/src/DeloitteDigital.Atlas.Tests/ItemExtensionsTests.cs index da1d459..1ab4891 100644 --- a/src/DeloitteDigital.Atlas.Tests/ItemExtensionsTests.cs +++ b/src/DeloitteDigital.Atlas.Tests/ItemExtensionsTests.cs @@ -1,20 +1,20 @@ using DeloitteDigital.Atlas.Extensions; using DeloitteDigital.Atlas.Tests.FakeDB; -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Shouldly; +using Xunit; namespace DeloitteDigital.Atlas.Tests { - [TestClass] public class ItemExtensionsTests { - [TestMethod] + [Fact] public void GetFieldsValueShouldReturnCorrectValue() { using (var db = new DspFakeDb()) { var home = db.GetHomeItem(); - Assert.IsTrue(home.GetFieldValue("Title").Equals("Sitecore Experience Platform")); + home.GetFieldValue("Title").ShouldBe("Sitecore Experience Platform"); } } } diff --git a/src/DeloitteDigital.Atlas.Tests/Mapping/FieldMappingTests.cs b/src/DeloitteDigital.Atlas.Tests/Mapping/FieldMappingTests.cs index 40d7b57..c2a1a45 100644 --- a/src/DeloitteDigital.Atlas.Tests/Mapping/FieldMappingTests.cs +++ b/src/DeloitteDigital.Atlas.Tests/Mapping/FieldMappingTests.cs @@ -1,14 +1,14 @@ using DeloitteDigital.Atlas.Caching; using DeloitteDigital.Atlas.Mapping; using DeloitteDigital.Atlas.Tests.FakeDB; -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Shouldly; +using Xunit; namespace DeloitteDigital.Atlas.Tests.Mapping { - [TestClass] public class FieldMappingTests { - [TestMethod] + [Fact] public void FieldMappingShouldMapTitle() { using (var db = new DspFakeDb()) @@ -16,8 +16,8 @@ public void FieldMappingShouldMapTitle() var mapper = new ItemMapper(new WebCache()); var sampleItem = mapper.Map(db.GetHomeItem()); - Assert.IsNotNull(sampleItem); - Assert.AreEqual("Sitecore Experience Platform", sampleItem.Title); + sampleItem.ShouldNotBeNull(); + sampleItem.Title.ShouldBe("Sitecore Experience Platform"); } } diff --git a/src/DeloitteDigital.Atlas.Tests/Mapping/ItemPropertyMappingTests.cs b/src/DeloitteDigital.Atlas.Tests/Mapping/ItemPropertyMappingTests.cs index 8a2dfa7..641e692 100644 --- a/src/DeloitteDigital.Atlas.Tests/Mapping/ItemPropertyMappingTests.cs +++ b/src/DeloitteDigital.Atlas.Tests/Mapping/ItemPropertyMappingTests.cs @@ -1,15 +1,15 @@ using DeloitteDigital.Atlas.Caching; using DeloitteDigital.Atlas.Mapping; using DeloitteDigital.Atlas.Tests.FakeDB; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Sitecore.Data; +using Shouldly; +using Xunit; namespace DeloitteDigital.Atlas.Tests.Mapping { - [TestClass] public class ItemPropertyMappingTests { - [TestMethod] + [Fact] public void ItemPropertyMappingShouldMapItemProperties() { using (var db = new DspFakeDb()) @@ -18,13 +18,14 @@ public void ItemPropertyMappingShouldMapItemProperties() var sampleItem = mapper.Map(db.GetHomeItem()); // assert item property mappings - Assert.IsNotNull(sampleItem); - Assert.AreEqual(new ID("{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"), sampleItem.ItemId); - Assert.AreEqual("Home", sampleItem.ItemName); - Assert.AreEqual("/sitecore/content/Home", sampleItem.ItemPath); - Assert.AreEqual("/en/sitecore/content/Home.aspx", sampleItem.ItemUrl); - Assert.AreEqual(new ID("{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}"), sampleItem.TemplateId); - Assert.AreEqual("Sample Item", sampleItem.TemplateName); + sampleItem.ShouldNotBeNull(); + sampleItem.ItemId.ShouldBe(new ID("{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}")); + sampleItem.ItemName.ShouldBe("Home"); + sampleItem.ItemPath.ShouldBe("/sitecore/content/Home"); + sampleItem.ItemUrl.ShouldBe("/en/sitecore/content/Home"); + sampleItem.TemplateId.ShouldBe(new ID("{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}")); + sampleItem.TemplateName.ShouldBe("Sample Item"); + sampleItem.ParentId.ShouldBe(new ID("{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}")); } } } diff --git a/src/DeloitteDigital.Atlas.Tests/Mapping/SampleItem.cs b/src/DeloitteDigital.Atlas.Tests/Mapping/SampleItem.cs index 3b936b7..ba02754 100644 --- a/src/DeloitteDigital.Atlas.Tests/Mapping/SampleItem.cs +++ b/src/DeloitteDigital.Atlas.Tests/Mapping/SampleItem.cs @@ -25,6 +25,9 @@ class SampleItem [ItemPropertyMap(ItemPropertyMappingType.TemplateName)] public string TemplateName { get; set; } + [ItemPropertyMap(ItemPropertyMappingType.ParentId)] + public ID ParentId { get; set; } + [FieldMap] public string Title { get; set; } diff --git a/src/DeloitteDigital.Atlas.Tests/Properties/AssemblyInfo.cs b/src/DeloitteDigital.Atlas.Tests/Properties/AssemblyInfo.cs index e7c8fcf..c990fdc 100644 --- a/src/DeloitteDigital.Atlas.Tests/Properties/AssemblyInfo.cs +++ b/src/DeloitteDigital.Atlas.Tests/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DeloitteDigital.Atlas.Tests")] -[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("2.3.0.0")] +[assembly: AssemblyFileVersion("2.3.0.0")] diff --git a/src/DeloitteDigital.Atlas.Tests/SitecoreMappingTests.cs b/src/DeloitteDigital.Atlas.Tests/SitecoreMappingTests.cs index 7e3c18e..c9586f6 100644 --- a/src/DeloitteDigital.Atlas.Tests/SitecoreMappingTests.cs +++ b/src/DeloitteDigital.Atlas.Tests/SitecoreMappingTests.cs @@ -2,19 +2,19 @@ using DeloitteDigital.Atlas.FieldRendering; using DeloitteDigital.Atlas.Mapping.FieldMapping; using DeloitteDigital.Atlas.Mapping.Meta; -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Shouldly; +using Xunit; namespace DeloitteDigital.Atlas.Tests { - [TestClass] public class SitecoreMappingTests { - [TestMethod] + [Fact] public void PropertyMetaBuilderShouldCorrectNumberOfMappedProperties() { var propertyMetaBuilder = new PropertyMetaBuilder(); var myModelPropertyMetaMap = propertyMetaBuilder.BuildPropertyMetaMap(); - Assert.AreEqual(1, myModelPropertyMetaMap.Count()); + myModelPropertyMetaMap.Count().ShouldBe(1); } public class MyModel diff --git a/src/DeloitteDigital.Atlas.Tests/app.config b/src/DeloitteDigital.Atlas.Tests/app.config index e47eedb..b920789 100644 --- a/src/DeloitteDigital.Atlas.Tests/app.config +++ b/src/DeloitteDigital.Atlas.Tests/app.config @@ -9,17 +9,20 @@ - + - + + - + + + @@ -30,7 +33,8 @@ - + + @@ -56,20 +60,7 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + diff --git a/src/DeloitteDigital.Atlas.Tests/packages.config b/src/DeloitteDigital.Atlas.Tests/packages.config deleted file mode 100644 index 29df5eb..0000000 --- a/src/DeloitteDigital.Atlas.Tests/packages.config +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/DeloitteDigital.Atlas/DeloitteDigital.Atlas.csproj b/src/DeloitteDigital.Atlas/DeloitteDigital.Atlas.csproj index d78b7e0..ad8346a 100644 --- a/src/DeloitteDigital.Atlas/DeloitteDigital.Atlas.csproj +++ b/src/DeloitteDigital.Atlas/DeloitteDigital.Atlas.csproj @@ -1,251 +1,206 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {601B96BD-D95F-4281-9A1B-7D99374DD869} - Library - Properties - DeloitteDigital.Atlas - DeloitteDigital.Atlas - v4.5.2 - 512 - - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\ - TRACE - prompt - 4 - false - - - - ..\..\packages\HtmlAgilityPack.1.4.9.5\lib\Net45\HtmlAgilityPack.dll - True - - - ..\..\packages\log4net.2.0.5\lib\net45-full\log4net.dll - True - - - True - ..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - - - ..\..\packages\Sitecore.Kernel.NoReferences.8.2.160729\lib\NET452\Sitecore.Kernel.dll - True - - - ..\..\packages\Sitecore.Mvc.NoReferences.8.2.160729\lib\NET452\Sitecore.Mvc.dll - True - - - - - - - - ..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll - True - - - ..\..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll - True - - - ..\..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll - True - - - ..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll - True - - - ..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll - True - - - ..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll - True - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ASPXCodeBehind - - - ASPXCodeBehind - - - - ASPXCodeBehind - - - - - - - - + + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {601B96BD-D95F-4281-9A1B-7D99374DD869} + Library + Properties + DeloitteDigital.Atlas + DeloitteDigital.Atlas + v4.8 + 512 + + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\ + TRACE + prompt + 4 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ASPXCodeBehind + + + ASPXCodeBehind + + + + ASPXCodeBehind + + + + + + Designer + + + + + 9.3.0 + + + + --> \ No newline at end of file diff --git a/src/DeloitteDigital.Atlas/DynamicPlaceholders/Pipelines/GetChromeData/GetDynamicPlaceholderChromeData.cs b/src/DeloitteDigital.Atlas/DynamicPlaceholders/Pipelines/GetChromeData/GetDynamicPlaceholderChromeData.cs index 54dd4c1..0d76e4e 100644 --- a/src/DeloitteDigital.Atlas/DynamicPlaceholders/Pipelines/GetChromeData/GetDynamicPlaceholderChromeData.cs +++ b/src/DeloitteDigital.Atlas/DynamicPlaceholders/Pipelines/GetChromeData/GetDynamicPlaceholderChromeData.cs @@ -1,4 +1,7 @@ using System; +using Microsoft.Extensions.DependencyInjection; +using Sitecore.Abstractions; +using Sitecore.DependencyInjection; using Sitecore.Diagnostics; using Sitecore.Pipelines.GetChromeData; @@ -9,6 +12,8 @@ namespace DeloitteDigital.Atlas.DynamicPlaceholders.Pipelines.GetChromeData /// public class GetDynamicPlaceholderChromeData : GetChromeDataProcessor { + public GetDynamicPlaceholderChromeData() : base(ServiceLocator.ServiceProvider.GetRequiredService()) { } + public override void Process(GetChromeDataArgs args) { Assert.ArgumentNotNull(args, "args"); diff --git a/src/DeloitteDigital.Atlas/Extensions/ItemExtensions.cs b/src/DeloitteDigital.Atlas/Extensions/ItemExtensions.cs index b930b7f..b0e6ee8 100644 --- a/src/DeloitteDigital.Atlas/Extensions/ItemExtensions.cs +++ b/src/DeloitteDigital.Atlas/Extensions/ItemExtensions.cs @@ -8,8 +8,8 @@ using Sitecore.Data.Templates; using Sitecore.Diagnostics; using Sitecore.Links; +using Sitecore.Links.UrlBuilders; using Sitecore.Resources.Media; -using Sitecore.SecurityModel; using Sitecore.Web.UI.WebControls; namespace DeloitteDigital.Atlas.Extensions @@ -21,24 +21,26 @@ namespace DeloitteDigital.Atlas.Extensions public static class ItemExtensions { /// - /// Gets field value from item with page editor support, and parameters for the field renderer + /// Gets field value from item with experience editor support, and parameters for the field renderer /// /// Sitecore item /// Field name - /// True if page editor support is required, otherwise false + /// True if experience editor support is required, otherwise false /// Field renderer parameters /// Field value or field renderer rendered control - public static string GetFieldValue(this Item item, string fieldName, bool pageEditorSupport = false, IDictionary attributes = null) + public static string GetFieldValue(this Item item, string fieldName, bool experienceEditorSupport = false, IDictionary attributes = null) { - if (pageEditorSupport) + if (experienceEditorSupport) { - var fieldRenderer = new FieldRenderer(); - fieldRenderer.Item = item; - fieldRenderer.FieldName = fieldName; + var fieldRenderer = new FieldRenderer + { + Item = item, + FieldName = fieldName + }; if (attributes != null) { fieldRenderer.Parameters = string.Join("&", - attributes.Keys.Select(k => string.Format("{0}={1}", k, attributes[k]))); + attributes.Keys.Select(k => $"{k}={attributes[k]}")); } return fieldRenderer.Render(); } @@ -112,11 +114,11 @@ public static string GetImageFieldMediaUrl(this Item item, string fieldName, int if (imageField?.MediaItem != null) { - var mediaUrlOptions = MediaUrlOptions.GetThumbnailOptions(imageField.MediaItem); - mediaUrlOptions.Width = width > 0 ? width : mediaUrlOptions.Width; - mediaUrlOptions.Height = height > 0 ? height : mediaUrlOptions.Height; - mediaUrlOptions.UseItemPath = true; - return MediaManager.GetMediaUrl(imageField.MediaItem, mediaUrlOptions); + var mediaUrlBuilderOptions = MediaUrlBuilderOptions.GetThumbnailOptions(imageField.MediaItem); + mediaUrlBuilderOptions.Width = width > 0 ? width : mediaUrlBuilderOptions.Width; + mediaUrlBuilderOptions.Height = height > 0 ? height : mediaUrlBuilderOptions.Height; + mediaUrlBuilderOptions.UseItemPath = true; + return MediaManager.GetMediaUrl(imageField.MediaItem, mediaUrlBuilderOptions); } else { diff --git a/src/DeloitteDigital.Atlas/FieldRendering/EmptyMediaRenderingString.cs b/src/DeloitteDigital.Atlas/FieldRendering/EmptyMediaRenderingString.cs index 175cbd3..8f4063c 100644 --- a/src/DeloitteDigital.Atlas/FieldRendering/EmptyMediaRenderingString.cs +++ b/src/DeloitteDigital.Atlas/FieldRendering/EmptyMediaRenderingString.cs @@ -1,6 +1,6 @@ using System; using Sitecore.Data.Items; -using Sitecore.Resources.Media; +using Sitecore.Links.UrlBuilders; namespace DeloitteDigital.Atlas.FieldRendering { @@ -20,7 +20,7 @@ public string Url() return string.Empty; } - public string Url(MediaUrlOptions mediaUrlOptions) + public string Url(MediaUrlBuilderOptions mediaUrlBuilderOptions) { return string.Empty; } diff --git a/src/DeloitteDigital.Atlas/FieldRendering/IMediaRenderingString.cs b/src/DeloitteDigital.Atlas/FieldRendering/IMediaRenderingString.cs index b150542..dad7109 100644 --- a/src/DeloitteDigital.Atlas/FieldRendering/IMediaRenderingString.cs +++ b/src/DeloitteDigital.Atlas/FieldRendering/IMediaRenderingString.cs @@ -1,5 +1,5 @@ using Sitecore.Data.Items; -using Sitecore.Resources.Media; +using Sitecore.Links.UrlBuilders; namespace DeloitteDigital.Atlas.FieldRendering { @@ -9,7 +9,7 @@ namespace DeloitteDigital.Atlas.FieldRendering public interface IMediaRenderingString : IFieldRenderingString { /// - /// Instructs the renderer to render the media URL only, not the image control or page editor control + /// Instructs the renderer to render the media URL only, not the image control or experience editor control /// /// The field's media url string UrlOnly(); @@ -24,7 +24,7 @@ public interface IMediaRenderingString : IFieldRenderingString /// Instructs the renderer to render the medial URL with specified url options /// /// The field's media URL - string Url(MediaUrlOptions mediaUrlOptions); + string Url(MediaUrlBuilderOptions mediaUrlBuilderOptions); /// /// Scales the image size by a specified percentage diff --git a/src/DeloitteDigital.Atlas/FieldRendering/MediaRenderingString.cs b/src/DeloitteDigital.Atlas/FieldRendering/MediaRenderingString.cs index 208bc2f..da268fa 100644 --- a/src/DeloitteDigital.Atlas/FieldRendering/MediaRenderingString.cs +++ b/src/DeloitteDigital.Atlas/FieldRendering/MediaRenderingString.cs @@ -1,5 +1,6 @@ using System; using Sitecore.Data.Items; +using Sitecore.Links.UrlBuilders; using Sitecore.Resources.Media; namespace DeloitteDigital.Atlas.FieldRendering @@ -20,14 +21,14 @@ public MediaRenderingString(Item item, string fieldName) } /// - /// Instructs the renderer to render the media URL only, not the image control or page editor control. + /// Instructs the renderer to render the media URL only, not the image control or experience editor control. /// This method will not respect the .ashx setting in the Sitecore configuration /// /// The field's media url [Obsolete("This method is obsolete. Please use Url() or Url(MediaOptions) instead")] public string UrlOnly() { - return Url(MediaUrlOptions.GetShellOptions()); + return Url(MediaUrlBuilderOptions.GetShellOptions()); } /// @@ -35,21 +36,21 @@ public string UrlOnly() /// public string Url() { - return Url(new MediaUrlOptions()); + return Url(new MediaUrlBuilderOptions()); } /// /// Instructs the render to render the media URL only using the provided media url options /// - public string Url(MediaUrlOptions mediaUrlOptions) + public string Url(MediaUrlBuilderOptions mediaUrlBuilderOptions) { var imageField = (Sitecore.Data.Fields.ImageField)Item.Fields[FieldName]; if (imageField?.MediaItem != null) { - mediaUrlOptions.Width = Attributes.ContainsKey("width") ? (int)Attributes["width"] : mediaUrlOptions.Width; - mediaUrlOptions.Height = Attributes.ContainsKey("height") ? (int)Attributes["height"] : mediaUrlOptions.Height; - return MediaManager.GetMediaUrl(imageField.MediaItem, mediaUrlOptions); + mediaUrlBuilderOptions.Width = Attributes.ContainsKey("width") ? (int)Attributes["width"] : mediaUrlBuilderOptions.Width; + mediaUrlBuilderOptions.Height = Attributes.ContainsKey("height") ? (int)Attributes["height"] : mediaUrlBuilderOptions.Height; + return MediaManager.GetMediaUrl(imageField.MediaItem, mediaUrlBuilderOptions); } else { diff --git a/src/DeloitteDigital.Atlas/Logging/Log4net/Log4netService.cs b/src/DeloitteDigital.Atlas/Logging/Log4net/Log4netService.cs index af31f0a..5569619 100644 --- a/src/DeloitteDigital.Atlas/Logging/Log4net/Log4netService.cs +++ b/src/DeloitteDigital.Atlas/Logging/Log4net/Log4netService.cs @@ -7,7 +7,7 @@ public class Log4netService : ILogService { public Log4netService() { - if (!LogManager.GetRepository().Configured) + if (!log4net.LogManager.GetLoggerRepository().Configured) { log4net.Config.XmlConfigurator.Configure(); } diff --git a/src/DeloitteDigital.Atlas/Mapping/ItemPropertyMapping/IdItemPropertyMapping.cs b/src/DeloitteDigital.Atlas/Mapping/ItemPropertyMapping/IdItemPropertyMapping.cs index 3815c38..f755148 100644 --- a/src/DeloitteDigital.Atlas/Mapping/ItemPropertyMapping/IdItemPropertyMapping.cs +++ b/src/DeloitteDigital.Atlas/Mapping/ItemPropertyMapping/IdItemPropertyMapping.cs @@ -28,6 +28,9 @@ public void SetItemPropertyMapping(TModel model, IPropertyMeta propertyM case ItemPropertyMappingType.TemplateId: idProperty.AssignValueToModelProperty(model, item.TemplateID); break; + case ItemPropertyMappingType.ParentId: + idProperty.AssignValueToModelProperty(model, item.ParentID ?? ID.Null); + break; } } } diff --git a/src/DeloitteDigital.Atlas/Mapping/ItemPropertyMapping/ItemPropertyMappingType.cs b/src/DeloitteDigital.Atlas/Mapping/ItemPropertyMapping/ItemPropertyMappingType.cs index dab2ca1..0e6f9b4 100644 --- a/src/DeloitteDigital.Atlas/Mapping/ItemPropertyMapping/ItemPropertyMappingType.cs +++ b/src/DeloitteDigital.Atlas/Mapping/ItemPropertyMapping/ItemPropertyMappingType.cs @@ -7,6 +7,7 @@ public enum ItemPropertyMappingType TemplateId, TemplateName, ItemName, - ItemPath + ItemPath, + ParentId } } diff --git a/src/DeloitteDigital.Atlas/Mvc/ErrorHandling/ICustomErrorView.cs b/src/DeloitteDigital.Atlas/Mvc/ErrorHandling/ICustomErrorView.cs index 7ebdba5..7d71c56 100644 --- a/src/DeloitteDigital.Atlas/Mvc/ErrorHandling/ICustomErrorView.cs +++ b/src/DeloitteDigital.Atlas/Mvc/ErrorHandling/ICustomErrorView.cs @@ -3,7 +3,7 @@ /// /// Implement this interface on Rendering Models to customise the rendering view used for /// error messages. E.g. used if the rendering does not output HTML or to change the behaviour - /// of PageEditor vs published site. + /// of ExperienceEditor vs published site. /// public interface ICustomErrorView { diff --git a/src/DeloitteDigital.Atlas/Mvc/HtmlExtensions.cs b/src/DeloitteDigital.Atlas/Mvc/HtmlExtensions.cs index f65933d..981ca02 100644 --- a/src/DeloitteDigital.Atlas/Mvc/HtmlExtensions.cs +++ b/src/DeloitteDigital.Atlas/Mvc/HtmlExtensions.cs @@ -18,9 +18,9 @@ public static MvcEditFrame BeginEditFrame(this HtmlHelper helper, string d return frame; } - public static IDisposable BeginLink(this HtmlHelper htmlHelper, ILinkFieldRenderingString linkField, string alternateTag = null, bool skipInPageEditor = false) + public static IDisposable BeginLink(this HtmlHelper htmlHelper, ILinkFieldRenderingString linkField, string alternateTag = null, bool skipInExperienceEditor = false) { - if (skipInPageEditor && global::Sitecore.Context.PageMode.IsExperienceEditor) + if (skipInExperienceEditor && global::Sitecore.Context.PageMode.IsExperienceEditor) return new EmptyMvcLink(); return new MvcLink(htmlHelper.ViewContext, linkField, alternateTag); } diff --git a/src/DeloitteDigital.Atlas/Mvc/PartialModel.cs b/src/DeloitteDigital.Atlas/Mvc/PartialModel.cs index 4d677bd..8ea5292 100644 --- a/src/DeloitteDigital.Atlas/Mvc/PartialModel.cs +++ b/src/DeloitteDigital.Atlas/Mvc/PartialModel.cs @@ -10,12 +10,9 @@ public PartialModel(TViewModel viewModel) } /// - /// Gets boolean value that indicate whether the current rendering context in page editor mode + /// Gets boolean value that indicate whether the current rendering context in experience editor mode /// - /// True if is in page editor mode, otherwise false - public bool IsPageEditor() - { - return Sitecore.Context.PageMode.IsExperienceEditor; - } + /// True if is in experience editor mode, otherwise false + public bool IsExperienceEditor => Sitecore.Context.PageMode.IsExperienceEditor; } } diff --git a/src/DeloitteDigital.Atlas/Mvc/RenderingModel.cs b/src/DeloitteDigital.Atlas/Mvc/RenderingModel.cs index b298d8c..36715ee 100644 --- a/src/DeloitteDigital.Atlas/Mvc/RenderingModel.cs +++ b/src/DeloitteDigital.Atlas/Mvc/RenderingModel.cs @@ -49,26 +49,17 @@ protected Item SiteStartItem /// /// Gets the current item from the Sitecore.Context class /// - protected Item CurrentItem - { - get - { - return Sitecore.Context.Item; - } - } + protected Item CurrentItem => Sitecore.Context.Item; /// - /// Gets boolean value that indicate whether the current rendering context in page editor mode + /// Gets boolean value that indicate whether the current rendering context in experience editor mode /// - /// True if is in page editor mode, otherwise false - public bool IsPageEditor() - { - return Context.PageMode.IsExperienceEditor; - } + /// True if is in experience editor mode, otherwise false + public bool IsExperienceEditor => Context.PageMode.IsExperienceEditor; - public bool HasValueOrIsPageEditor(IFieldRenderingString fieldRenderingString) + public bool HasValueOrIsExperienceEditor(IFieldRenderingString fieldRenderingString) { - return IsPageEditor() || HasValue(fieldRenderingString); + return IsExperienceEditor || HasValue(fieldRenderingString); } public bool HasValue(IFieldRenderingString fieldRenderingString) @@ -76,9 +67,9 @@ public bool HasValue(IFieldRenderingString fieldRenderingString) return (!string.IsNullOrEmpty(fieldRenderingString?.ToString())); } - public bool HasValueOrIsPageEditor(IMediaRenderingString fieldRenderingString) + public bool HasValueOrIsExperienceEditor(IMediaRenderingString fieldRenderingString) { - return IsPageEditor() || HasValue(fieldRenderingString); + return IsExperienceEditor || HasValue(fieldRenderingString); } public bool HasValue(IMediaRenderingString fieldRenderingString) diff --git a/src/DeloitteDigital.Atlas/Mvc/SitecoreBaseController.cs b/src/DeloitteDigital.Atlas/Mvc/SitecoreBaseController.cs index 98213f5..3bb40d9 100644 --- a/src/DeloitteDigital.Atlas/Mvc/SitecoreBaseController.cs +++ b/src/DeloitteDigital.Atlas/Mvc/SitecoreBaseController.cs @@ -50,22 +50,13 @@ protected Item SiteStartItem /// /// Gets the current item from the Sitecore.Context class /// - protected Item CurrentItem - { - get - { - return Sitecore.Context.Item; - } - } + protected Item CurrentItem => Sitecore.Context.Item; /// - /// Gets boolean value that indicate whether the current rendering context in page editor mode + /// Gets boolean value that indicate whether the current rendering context in experience editor mode /// - /// True if is in page editor mode, otherwise false - public bool IsPageEditor() - { - return Sitecore.Context.PageMode.IsExperienceEditor; - } + /// True if is in experience editor mode, otherwise false + public bool IsExperienceEditor => Sitecore.Context.PageMode.IsExperienceEditor; } } diff --git a/src/DeloitteDigital.Atlas/Mvvm/LayoutView.cs b/src/DeloitteDigital.Atlas/Mvvm/LayoutView.cs index a80232a..7f44073 100644 --- a/src/DeloitteDigital.Atlas/Mvvm/LayoutView.cs +++ b/src/DeloitteDigital.Atlas/Mvvm/LayoutView.cs @@ -26,12 +26,9 @@ public abstract class LayoutView : Page protected bool HasError { get; private set; } /// - /// Gets the boolean value that indicates wether it's in the page editor mode + /// Gets the boolean value that indicates whether it's in the experience editor mode /// - protected bool IsPageEditor - { - get { return viewHelper.IsPageEditor(); } - } + protected bool IsExperienceEditor => viewHelper.IsExperienceEditor; /// /// Resolves a service instance @@ -43,15 +40,9 @@ protected TService Resolve() return this.viewHelper.ResolveService(); } - protected Item SiteRootItem - { - get { return this.viewHelper.GetSiteItem(); } - } + protected Item SiteRootItem => this.viewHelper.GetSiteItem(); - protected Item SiteStartItem - { - get { return this.viewHelper.GetSiteStartItem(); } - } + protected Item SiteStartItem => this.viewHelper.GetSiteStartItem(); /// /// Runs when control initialises diff --git a/src/DeloitteDigital.Atlas/Mvvm/SublayoutView.cs b/src/DeloitteDigital.Atlas/Mvvm/SublayoutView.cs index 05b8f0b..6df7b54 100644 --- a/src/DeloitteDigital.Atlas/Mvvm/SublayoutView.cs +++ b/src/DeloitteDigital.Atlas/Mvvm/SublayoutView.cs @@ -22,17 +22,14 @@ public abstract class SublayoutView : UserControl protected TViewModel ViewModel { get; private set; } /// - /// Gets or sets the value that indicates whether an error has occured while trying to initialise the view model object + /// Gets or sets the value that indicates whether an error has occurred while trying to initialise the view model object /// protected bool HasError { get; private set; } /// - /// Gets the boolean value that indicates wether it's in the page editor mode + /// Gets the boolean value that indicates whether it's in the experience editor mode /// - protected bool IsPageEditor - { - get { return viewHelper.IsPageEditor(); } - } + protected bool IsExperienceEditor => viewHelper.IsExperienceEditor; /// /// Resolves a service instance @@ -44,15 +41,9 @@ protected TService Resolve() return this.viewHelper.ResolveService(); } - protected Item SiteRootItem - { - get { return this.viewHelper.GetSiteItem(); } - } + protected Item SiteRootItem => this.viewHelper.GetSiteItem(); - protected Item SiteStartItem - { - get { return this.viewHelper.GetSiteStartItem(); } - } + protected Item SiteStartItem => this.viewHelper.GetSiteStartItem(); /// /// Runs when control initialises diff --git a/src/DeloitteDigital.Atlas/Mvvm/UserControlView.cs b/src/DeloitteDigital.Atlas/Mvvm/UserControlView.cs index c946d5b..0b5aaa0 100644 --- a/src/DeloitteDigital.Atlas/Mvvm/UserControlView.cs +++ b/src/DeloitteDigital.Atlas/Mvvm/UserControlView.cs @@ -25,12 +25,9 @@ public abstract class UserControlView : UserControl protected bool HasError { get; private set; } /// - /// Gets the boolean value that indicates wether it's in the page editor mode + /// Gets the boolean value that indicates whether it's in the experience editor mode /// - public bool IsPageEditor - { - get { return viewHelper.IsPageEditor(); } - } + public bool IsExperienceEditor => viewHelper.IsExperienceEditor; /// /// Resolves a service instance diff --git a/src/DeloitteDigital.Atlas/Mvvm/ViewControlHelper.cs b/src/DeloitteDigital.Atlas/Mvvm/ViewControlHelper.cs index ad78fb9..40d1f0d 100644 --- a/src/DeloitteDigital.Atlas/Mvvm/ViewControlHelper.cs +++ b/src/DeloitteDigital.Atlas/Mvvm/ViewControlHelper.cs @@ -73,13 +73,10 @@ public TService ResolveService() } /// - /// Gets boolean value that indicate whether the current rendering context in page editor mode + /// Gets boolean value that indicate whether the current rendering context in experience editor mode /// - /// True if is in page editor mode, otherwise false - public bool IsPageEditor() - { - return Sitecore.Context.PageMode.IsExperienceEditor; - } + /// True if is in experience editor mode, otherwise false + public bool IsExperienceEditor => Sitecore.Context.PageMode.IsExperienceEditor; /// /// Logs an error message diff --git a/src/DeloitteDigital.Atlas/Properties/AssemblyInfo.cs b/src/DeloitteDigital.Atlas/Properties/AssemblyInfo.cs index 6251488..d886967 100644 --- a/src/DeloitteDigital.Atlas/Properties/AssemblyInfo.cs +++ b/src/DeloitteDigital.Atlas/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Deloitte Digital")] [assembly: AssemblyProduct("DeloitteDigital.Atlas")] -[assembly: AssemblyCopyright("Copyright © Deloitte Digital 2016")] +[assembly: AssemblyCopyright("Copyright © Deloitte Digital 2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,6 +32,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: AssemblyInformationalVersion("1.0.0")] \ No newline at end of file +[assembly: AssemblyVersion("2.3.0.0")] +[assembly: AssemblyFileVersion("2.3.0.0")] +[assembly: AssemblyInformationalVersion("2.1.0")] \ No newline at end of file diff --git a/src/DeloitteDigital.Atlas/app.config b/src/DeloitteDigital.Atlas/app.config index 1cd6675..5eb915d 100644 --- a/src/DeloitteDigital.Atlas/app.config +++ b/src/DeloitteDigital.Atlas/app.config @@ -1,11 +1,6 @@  - - - - - - - - - \ No newline at end of file + + + + diff --git a/src/DeloitteDigital.Atlas/packages.config b/src/DeloitteDigital.Atlas/packages.config deleted file mode 100644 index 79299ad..0000000 --- a/src/DeloitteDigital.Atlas/packages.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file