From f049b6a56ed4b37f8c0a0b4d1d1b65f1076ce7c6 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Wed, 5 Sep 2018 09:48:12 +0100 Subject: [PATCH 01/10] Bumping version number for hotfixes [skip ci] --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 36d9d40..548c278 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,7 @@ image: Visual Studio 2017 # version format -version: 2.0.2.{build} +version: 2.0.3.{build} # UMBRACO_PACKAGE_PRERELEASE_SUFFIX if a rtm release build this should be blank, otherwise if empty will default to alpha # example UMBRACO_PACKAGE_PRERELEASE_SUFFIX=beta From 8d0d38939c965271cb188b87991890fafda9a4d6 Mon Sep 17 00:00:00 2001 From: Frederik Nikolaj Schaarup Reher Date: Tue, 30 Oct 2018 00:01:55 +0100 Subject: [PATCH 02/10] fixed localization of doctype naming in overlay content type selector --- .../Our.Umbraco.InnerContent.csproj | 1 + .../Controllers/InnerContentApiController.cs | 8 ++-- .../Controllers/InnerContentBaseController.cs | 39 +++++++++++++++++++ 3 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentBaseController.cs diff --git a/src/Our.Umbraco.InnerContent/Our.Umbraco.InnerContent.csproj b/src/Our.Umbraco.InnerContent/Our.Umbraco.InnerContent.csproj index 1fbe474..85f3a3d 100644 --- a/src/Our.Umbraco.InnerContent/Our.Umbraco.InnerContent.csproj +++ b/src/Our.Umbraco.InnerContent/Our.Umbraco.InnerContent.csproj @@ -81,6 +81,7 @@ + diff --git a/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentApiController.cs b/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentApiController.cs index df92c08..7da0e80 100644 --- a/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentApiController.cs +++ b/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentApiController.cs @@ -14,7 +14,7 @@ namespace Our.Umbraco.InnerContent.Web.Controllers { [PluginController("InnerContent")] - public class InnerContentApiController : UmbracoAuthorizedJsonController + public class InnerContentApiController : InnerContentBaseController { [HttpGet] public IEnumerable GetAllContentTypes() @@ -25,7 +25,7 @@ public IEnumerable GetAllContentTypes() { id = x.Id, guid = x.Key, - name = x.Name, + name = TranslateItem(x.Name), alias = x.Alias, icon = string.IsNullOrWhiteSpace(x.Icon) || x.Icon == ".sprTreeFolder" ? "icon-folder" : x.Icon, tabs = x.CompositionPropertyGroups.Select(y => y.Name).Distinct() @@ -45,7 +45,7 @@ public IEnumerable GetContentTypesByGuid([ModelBinder] Guid[] guids) // Umbraco core uses `localizedTextService.UmbracoDictionaryTranslate`, but this is currently marked as internal. // https://github.com/umbraco/Umbraco-CMS/blob/release-7.7.0/src/Umbraco.Core/Services/LocalizedTextServiceExtensions.cs#L76 - name = ct.Name, + name = TranslateItem(ct.Name), description = ct.Description, guid = ct.Key, key = ct.Key, @@ -64,7 +64,7 @@ public IEnumerable GetContentTypesByAlias([ModelBinder] string[] aliases { id = x.Id, guid = x.Key, - name = x.Name, + name = TranslateItem(x.Name), alias = x.Alias, icon = string.IsNullOrWhiteSpace(x.Icon) || x.Icon == ".sprTreeFolder" ? "icon-folder" : x.Icon, tabs = x.CompositionPropertyGroups.Select(y => y.Name).Distinct() diff --git a/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentBaseController.cs b/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentBaseController.cs new file mode 100644 index 0000000..b050696 --- /dev/null +++ b/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentBaseController.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Umbraco.Core; +using Umbraco.Core.Dictionary; +using Umbraco.Web.Editors; + +namespace Our.Umbraco.InnerContent.Web.Controllers +{ + public class InnerContentBaseController : UmbracoAuthorizedJsonController + { + private static ICultureDictionary _cultureDictionary; + private static ICultureDictionary CultureDictionary + { + get + { + return + _cultureDictionary ?? + (_cultureDictionary = CultureDictionaryFactoryResolver.Current.Factory.CreateDictionary()); + } + } + + public string TranslateItem(string text) + { + if (text == null) + { + return null; + } + + if (text.StartsWith("#") == false) + return text; + + text = text.Substring(1); + return CultureDictionary[text].IfNullOrWhiteSpace(text); + } + } +} From d402014af17c3b68a2f8c954ed73e7440476eaaf Mon Sep 17 00:00:00 2001 From: leekelleher Date: Mon, 12 Nov 2018 17:37:28 +0000 Subject: [PATCH 03/10] :chocolate_bar: Updated NuGet API key --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 548c278..880e43e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -47,7 +47,7 @@ deploy: - provider: NuGet server: api_key: - secure: 0+oAleUTnr9UuJrhLW5rphRR+QGz00XX1Ui3k5kwyr2kUdEamiQ3F+gW0q8MJbDT + secure: vEophXSqus5F60LRBY4/j1l6K/S5+n3/yYpiID3O7JJW1gyj+0q0enuHhN3tgdhl artifact: /.*\.nupkg/ on: branch: master From 5f7ccfb783a458cf6193669c1b55648cc6d9a935 Mon Sep 17 00:00:00 2001 From: Frederik Nikolaj Schaarup Reher Date: Fri, 16 Nov 2018 10:40:23 +0100 Subject: [PATCH 04/10] move translation method from controllerbase to concrete controller --- .../Our.Umbraco.InnerContent.csproj | 1 - .../Controllers/InnerContentApiController.cs | 29 +++++++++++++- .../Controllers/InnerContentBaseController.cs | 39 ------------------- 3 files changed, 28 insertions(+), 41 deletions(-) delete mode 100644 src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentBaseController.cs diff --git a/src/Our.Umbraco.InnerContent/Our.Umbraco.InnerContent.csproj b/src/Our.Umbraco.InnerContent/Our.Umbraco.InnerContent.csproj index 85f3a3d..1fbe474 100644 --- a/src/Our.Umbraco.InnerContent/Our.Umbraco.InnerContent.csproj +++ b/src/Our.Umbraco.InnerContent/Our.Umbraco.InnerContent.csproj @@ -81,7 +81,6 @@ - diff --git a/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentApiController.cs b/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentApiController.cs index 7da0e80..e8c83ba 100644 --- a/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentApiController.cs +++ b/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentApiController.cs @@ -6,6 +6,8 @@ using Newtonsoft.Json.Linq; using Our.Umbraco.InnerContent.Helpers; using Our.Umbraco.InnerContent.Web.WebApi.Filters; +using Umbraco.Core; +using Umbraco.Core.Dictionary; using Umbraco.Core.Services; using Umbraco.Web.Editors; using Umbraco.Web.Models.ContentEditing; @@ -14,7 +16,7 @@ namespace Our.Umbraco.InnerContent.Web.Controllers { [PluginController("InnerContent")] - public class InnerContentApiController : InnerContentBaseController + public class InnerContentApiController : UmbracoAuthorizedJsonController { [HttpGet] public IEnumerable GetAllContentTypes() @@ -108,5 +110,30 @@ public SimpleNotificationModel CreateBlueprintFromContent([FromBody] JObject ite Services.TextService.Localize("blueprints/createdBlueprintMessage", new[] { blueprint.Name }), global::Umbraco.Web.UI.SpeechBubbleIcon.Success)); } + + private static ICultureDictionary _cultureDictionary; + private static ICultureDictionary CultureDictionary + { + get + { + return + _cultureDictionary ?? + (_cultureDictionary = CultureDictionaryFactoryResolver.Current.Factory.CreateDictionary()); + } + } + + public string TranslateItem(string text) + { + if (text == null) + { + return null; + } + + if (text.StartsWith("#") == false) + return text; + + text = text.Substring(1); + return CultureDictionary[text].IfNullOrWhiteSpace(text); + } } } \ No newline at end of file diff --git a/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentBaseController.cs b/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentBaseController.cs deleted file mode 100644 index b050696..0000000 --- a/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentBaseController.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Umbraco.Core; -using Umbraco.Core.Dictionary; -using Umbraco.Web.Editors; - -namespace Our.Umbraco.InnerContent.Web.Controllers -{ - public class InnerContentBaseController : UmbracoAuthorizedJsonController - { - private static ICultureDictionary _cultureDictionary; - private static ICultureDictionary CultureDictionary - { - get - { - return - _cultureDictionary ?? - (_cultureDictionary = CultureDictionaryFactoryResolver.Current.Factory.CreateDictionary()); - } - } - - public string TranslateItem(string text) - { - if (text == null) - { - return null; - } - - if (text.StartsWith("#") == false) - return text; - - text = text.Substring(1); - return CultureDictionary[text].IfNullOrWhiteSpace(text); - } - } -} From 91c7051da573df16746790d21ac4fedf51b7eb4d Mon Sep 17 00:00:00 2001 From: leekelleher Date: Wed, 12 Dec 2018 12:11:26 +0000 Subject: [PATCH 05/10] Minor refactoring of content-type localization - Renamed the method from `TranslateItem` to `UmbracoDictionaryTranslate`. (Following Umbraco's naming) - Marked `UmbracoDictionaryTranslate` method as private, (it's not intended for external use) - Removed the `CultureDictionary` property. Didn't see the sense in having a private field and property - Updated TODO message, if Umbraco core make their method public, then we can remove our custom one --- .../Controllers/InnerContentApiController.cs | 37 +++++++++---------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentApiController.cs b/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentApiController.cs index e8c83ba..0c5b8c9 100644 --- a/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentApiController.cs +++ b/src/Our.Umbraco.InnerContent/Web/Controllers/InnerContentApiController.cs @@ -27,7 +27,7 @@ public IEnumerable GetAllContentTypes() { id = x.Id, guid = x.Key, - name = TranslateItem(x.Name), + name = UmbracoDictionaryTranslate(x.Name), alias = x.Alias, icon = string.IsNullOrWhiteSpace(x.Icon) || x.Icon == ".sprTreeFolder" ? "icon-folder" : x.Icon, tabs = x.CompositionPropertyGroups.Select(y => y.Name).Distinct() @@ -43,11 +43,7 @@ public IEnumerable GetContentTypesByGuid([ModelBinder] Guid[] guids) // NOTE: Using an anonymous class, as the `ContentTypeBasic` type is heavier than what we need (for our requirements) return contentTypes.Select(ct => new { - // TODO: localize the name and description (in case of dictionary items) - // Umbraco core uses `localizedTextService.UmbracoDictionaryTranslate`, but this is currently marked as internal. - // https://github.com/umbraco/Umbraco-CMS/blob/release-7.7.0/src/Umbraco.Core/Services/LocalizedTextServiceExtensions.cs#L76 - - name = TranslateItem(ct.Name), + name = UmbracoDictionaryTranslate(ct.Name), description = ct.Description, guid = ct.Key, key = ct.Key, @@ -66,7 +62,7 @@ public IEnumerable GetContentTypesByAlias([ModelBinder] string[] aliases { id = x.Id, guid = x.Key, - name = TranslateItem(x.Name), + name = UmbracoDictionaryTranslate(x.Name), alias = x.Alias, icon = string.IsNullOrWhiteSpace(x.Icon) || x.Icon == ".sprTreeFolder" ? "icon-folder" : x.Icon, tabs = x.CompositionPropertyGroups.Select(y => y.Name).Distinct() @@ -111,18 +107,9 @@ public SimpleNotificationModel CreateBlueprintFromContent([FromBody] JObject ite global::Umbraco.Web.UI.SpeechBubbleIcon.Success)); } - private static ICultureDictionary _cultureDictionary; - private static ICultureDictionary CultureDictionary - { - get - { - return - _cultureDictionary ?? - (_cultureDictionary = CultureDictionaryFactoryResolver.Current.Factory.CreateDictionary()); - } - } - - public string TranslateItem(string text) + // Umbraco core's `localizedTextService.UmbracoDictionaryTranslate` is internal. Until it's made public, we have to roll our own. + // https://github.com/umbraco/Umbraco-CMS/blob/release-7.7.0/src/Umbraco.Core/Services/LocalizedTextServiceExtensions.cs#L76 + private string UmbracoDictionaryTranslate(string text) { if (text == null) { @@ -130,10 +117,20 @@ public string TranslateItem(string text) } if (text.StartsWith("#") == false) + { return text; + } text = text.Substring(1); - return CultureDictionary[text].IfNullOrWhiteSpace(text); + + if (_cultureDictionary == null) + { + _cultureDictionary = CultureDictionaryFactoryResolver.Current.Factory.CreateDictionary(); + } + + return _cultureDictionary[text].IfNullOrWhiteSpace(text); } + + private static ICultureDictionary _cultureDictionary; } } \ No newline at end of file From c44b6799be5894cea226d85d9ff0711f3cdf04ca Mon Sep 17 00:00:00 2001 From: leekelleher Date: Thu, 20 Dec 2018 16:30:48 +0000 Subject: [PATCH 06/10] Added classes to the overlay/modal This enhancement adds class names to the overlay markup, this will allow a developer to target CSS selectors for the following... - Property Alias - Document Type (of the Inner Content item) - Overlay depth For background on this enhancement, please see the Stacked Content ticket: https://github.com/umco/umbraco-stacked-content/issues/61 --- .../InnerContent/js/innercontent.js | 21 ++++++++++++++++++- .../views/innercontent.overlay.html | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/js/innercontent.js b/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/js/innercontent.js index 3856bb0..6018f63 100644 --- a/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/js/innercontent.js +++ b/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/js/innercontent.js @@ -156,14 +156,16 @@ angular.module("umbraco").controller("Our.Umbraco.InnerContent.Controllers.Inner angular.module("umbraco.directives").directive("innerContentOverlay", [ "$q", + "overlayHelper", "innerContentService", - function ($q, innerContentService) { + function ($q, overlayHelper, innerContentService) { function link(scope, el, attr, ctrl) { scope.config.editorModels = scope.config.editorModels || {}; scope.currentItem = null; + scope.overlayClasses = scope.overlayClasses || []; var getContentType = function (guid) { return _.find(scope.config.contentTypes, function (ct) { @@ -250,6 +252,7 @@ angular.module("umbraco.directives").directive("innerContentOverlay", [ scope.openContentEditorOverlay(); }); } else { + setOverlayClasses("create"); scope.contentTypePickerOverlay.event = scope.config.event; scope.contentTypePickerOverlay.show = true; } @@ -261,26 +264,42 @@ angular.module("umbraco.directives").directive("innerContentOverlay", [ }; scope.openContentEditorOverlay = function () { + setOverlayClasses(scope.config.propertyAlias, scope.currentItem.contentTypeAlias); scope.contentEditorOverlay.title = "Edit " + scope.currentItem.contentTypeName; scope.contentEditorOverlay.dialogData = { item: scope.currentItem }; scope.contentEditorOverlay.show = true; }; scope.closeContentEditorOverlay = function () { + scope.overlayClasses = []; scope.contentEditorOverlay.show = false; }; scope.closeAllOverlays = function () { + scope.overlayClasses = []; scope.closeContentTypePickerOverlay(); scope.closeContentEditorOverlay(); scope.config.show = false; }; + function setOverlayClasses() { + // Ensures that the "create" and "edit" classes don't conflict. + if (scope.overlayClasses.length > 1) { + scope.overlayClasses.length = 1; + } + for (var i = 0; i < arguments.length; i++) { + scope.overlayClasses.push("inner-content-overlay--" + arguments[i]); + } + }; + var initOpen = function () { // Map scaffolds to content type picker list scope.contentTypePickerOverlay.availableItems = scope.config.contentTypePickerItems; + // Set the overlay class for the overlay's (overlapping) index + setOverlayClasses("overlay" + overlayHelper.getNumberOfOverlays()); + // Open relevant dialog if (!scope.config.data || !scope.config.data.model) { scope.openContentTypePickerOverlay(); diff --git a/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/views/innercontent.overlay.html b/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/views/innercontent.overlay.html index 663d047..da0e51b 100644 --- a/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/views/innercontent.overlay.html +++ b/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/views/innercontent.overlay.html @@ -1,4 +1,4 @@ -
+
Date: Fri, 11 Jan 2019 15:20:04 +0000 Subject: [PATCH 07/10] Updated following @mattbrailsford's feedback --- .../UI/App_Plugins/InnerContent/js/innercontent.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/js/innercontent.js b/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/js/innercontent.js index 6018f63..6147182 100644 --- a/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/js/innercontent.js +++ b/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/js/innercontent.js @@ -271,19 +271,25 @@ angular.module("umbraco.directives").directive("innerContentOverlay", [ }; scope.closeContentEditorOverlay = function () { - scope.overlayClasses = []; + resetOverlayClasses(); scope.contentEditorOverlay.show = false; }; scope.closeAllOverlays = function () { - scope.overlayClasses = []; + resetOverlayClasses(); scope.closeContentTypePickerOverlay(); scope.closeContentEditorOverlay(); scope.config.show = false; }; + function resetOverlayClasses() { + scope.overlayClasses = []; + }; + function setOverlayClasses() { - // Ensures that the "create" and "edit" classes don't conflict. + // When creating new blocks, the "create" class would be added, then editing it would + // add the property-alias & content-type alias classes. But we no longer want the "create" class. + // We reduce the array down to the first time, e.g. the "overlay0" class. if (scope.overlayClasses.length > 1) { scope.overlayClasses.length = 1; } From 56db277cfb11c8de9e69e0d3ff99d38686742b64 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Fri, 11 Jan 2019 16:19:26 +0000 Subject: [PATCH 08/10] Refactored the DetachedPublishedContent class Making use of Umbraco v7.7.0's DetachedPublishedContent, removing duplicate code, but keeping our own extensions. Using C# expression-bodied members instead of old-style getters. --- src/Our.Umbraco.InnerContent/Bootstrap.cs | 4 +- .../Models/DetachedPublishedContent.cs | 145 ++---------------- .../Models/DetachedPublishedProperty.cs | 16 +- 3 files changed, 17 insertions(+), 148 deletions(-) diff --git a/src/Our.Umbraco.InnerContent/Bootstrap.cs b/src/Our.Umbraco.InnerContent/Bootstrap.cs index 853145a..5bfa25b 100644 --- a/src/Our.Umbraco.InnerContent/Bootstrap.cs +++ b/src/Our.Umbraco.InnerContent/Bootstrap.cs @@ -17,7 +17,7 @@ protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplica return; // NOTE: The properties for the JSON payload are available here: (Currently there isn't a public API to deserialize the payload) - // https://github.com/umbraco/Umbraco-CMS/blob/release-7.4.0/src/Umbraco.Web/Cache/DataTypeCacheRefresher.cs#L64-L68 + // https://github.com/umbraco/Umbraco-CMS/blob/release-7.7.0/src/Umbraco.Web/Cache/DataTypeCacheRefresher.cs#L66-L70 var payload = JsonConvert.DeserializeAnonymousType((string)e.MessageObject, new[] { new { Id = default(int) } }); if (payload == null) return; @@ -34,7 +34,7 @@ protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplica return; // NOTE: The properties for the JSON payload are available here: (Currently there isn't a public API to deserialize the payload) - // https://github.com/umbraco/Umbraco-CMS/blob/release-7.4.0/src/Umbraco.Web/Cache/ContentTypeCacheRefresher.cs#L93-L109 + // https://github.com/umbraco/Umbraco-CMS/blob/release-7.7.0/src/Umbraco.Web/Cache/ContentTypeCacheRefresher.cs#L91-L109 var payload = JsonConvert.DeserializeAnonymousType((string)e.MessageObject, new[] { new { Id = default(int), AliasChanged = default(bool) } }); if (payload == null) return; diff --git a/src/Our.Umbraco.InnerContent/Models/DetachedPublishedContent.cs b/src/Our.Umbraco.InnerContent/Models/DetachedPublishedContent.cs index 9bf1416..e6ee56f 100644 --- a/src/Our.Umbraco.InnerContent/Models/DetachedPublishedContent.cs +++ b/src/Our.Umbraco.InnerContent/Models/DetachedPublishedContent.cs @@ -1,26 +1,19 @@ using System; using System.Collections.Generic; using System.Linq; -using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; -using Umbraco.Web.Models; +using UmbracoWebModels = Umbraco.Web.Models; namespace Our.Umbraco.InnerContent.Models { - public class DetachedPublishedContent : PublishedContentBase, IPublishedContentWithKey + // NOTE: Inherits from https://github.com/umbraco/Umbraco-CMS/blob/release-7.7.0/src/Umbraco.Web/Models/DetachedPublishedContent.cs + // The main differences are that this one can set the Level, Children and Parent, (and includes a recursive `GetProperty` method). + public class DetachedPublishedContent : UmbracoWebModels.DetachedPublishedContent { - private readonly Guid _key; - private readonly string _name; - private readonly PublishedContentType _contentType; - private readonly IEnumerable _properties; - private readonly int _sortOrder; - private readonly bool _isPreviewing; - private readonly IPublishedContent _containerNode; - private readonly IPublishedContent _parentNode; private IEnumerable _children; - private int _level; + private readonly int _level; public DetachedPublishedContent(Guid key, string name, @@ -31,15 +24,9 @@ public DetachedPublishedContent(Guid key, int sortOrder = 0, int level = 0, bool isPreviewing = false) + : base(key, name, contentType, properties, containerNode, sortOrder, isPreviewing) { - _key = key; - _name = name; - _contentType = contentType; - _properties = properties; - _sortOrder = sortOrder; _level = level; - _isPreviewing = isPreviewing; - _containerNode = containerNode; _parentNode = parentNode; _children = Enumerable.Empty(); } @@ -49,56 +36,6 @@ public void SetChildren(IEnumerable children) _children = children; } - public Guid Key - { - get { return _key; } - } - - public override int Id - { - get { return 0; } - } - - public override string Name - { - get { return _name; } - } - - public override bool IsDraft - { - get { return _isPreviewing; } - } - - public override PublishedItemType ItemType - { - get { return PublishedItemType.Content; } - } - - public override PublishedContentType ContentType - { - get { return _contentType; } - } - - public override string DocumentTypeAlias - { - get { return _contentType.Alias; } - } - - public override int DocumentTypeId - { - get { return _contentType.Id; } - } - - public override ICollection Properties - { - get { return _properties.ToArray(); } - } - - public override IPublishedProperty GetProperty(string alias) - { - return _properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias)); - } - public override IPublishedProperty GetProperty(string alias, bool recurse) { var prop = GetProperty(alias); @@ -109,74 +46,10 @@ public override IPublishedProperty GetProperty(string alias, bool recurse) return prop; } - public override IPublishedContent Parent - { - get { return _parentNode; } - } - - public override IEnumerable Children - { - get { return _children; } - } - - public override int TemplateId - { - get { return 0; } - } - - public override int SortOrder - { - get { return _sortOrder; } - } - - public override string UrlName - { - get { return null; } - } - - public override string WriterName - { - get { return _containerNode != null ? _containerNode.WriterName : null; } - } + public override IPublishedContent Parent => _parentNode; - public override string CreatorName - { - get { return _containerNode != null ? _containerNode.CreatorName : null; } - } - - public override int WriterId - { - get { return _containerNode != null ? _containerNode.WriterId : 0; } - } + public override IEnumerable Children => _children; - public override int CreatorId - { - get { return _containerNode != null ? _containerNode.CreatorId : 0; } - } - - public override string Path - { - get { return null; } - } - - public override DateTime CreateDate - { - get { return _containerNode != null ? _containerNode.CreateDate : DateTime.MinValue; } - } - - public override DateTime UpdateDate - { - get { return _containerNode != null ? _containerNode.UpdateDate : DateTime.MinValue; } - } - - public override Guid Version - { - get { return _containerNode != null ? _containerNode.Version : Guid.Empty; } - } - - public override int Level - { - get { return _level; } - } + public override int Level => _level; } } \ No newline at end of file diff --git a/src/Our.Umbraco.InnerContent/Models/DetachedPublishedProperty.cs b/src/Our.Umbraco.InnerContent/Models/DetachedPublishedProperty.cs index f39a7f9..717778c 100644 --- a/src/Our.Umbraco.InnerContent/Models/DetachedPublishedProperty.cs +++ b/src/Our.Umbraco.InnerContent/Models/DetachedPublishedProperty.cs @@ -4,6 +4,8 @@ namespace Our.Umbraco.InnerContent.Models { + // NOTE: If Umbraco's `DetachedPublishedProperty` isn't currently publicly available. + // https://github.com/umbraco/Umbraco-CMS/blob/release-7.7.0/src/Umbraco.Web/Models/DetachedPublishedProperty.cs#L7 public class DetachedPublishedProperty : IPublishedProperty { private readonly PublishedPropertyType _propertyType; @@ -29,23 +31,17 @@ public DetachedPublishedProperty(PublishedPropertyType propertyType, object valu _xpathValue = new Lazy(() => _propertyType.ConvertSourceToXPath(_sourceValue.Value, _isPreview)); } - public string PropertyTypeAlias - { - get - { - return _propertyType.PropertyTypeAlias; - } - } + public string PropertyTypeAlias => _propertyType.PropertyTypeAlias; public bool HasValue { get { return DataValue != null && DataValue.ToString().Trim().Length > 0; } } - public object DataValue { get { return _rawValue; } } + public object DataValue => _rawValue; - public object Value { get { return _objectValue.Value; } } + public object Value => _objectValue.Value; - public object XPathValue { get { return _xpathValue.Value; } } + public object XPathValue => _xpathValue.Value; } } \ No newline at end of file From 61da91d26e5e384b4ec28093075d4901966774ca Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 24 Jan 2019 16:14:26 -0800 Subject: [PATCH 09/10] Add filtering to docType selection overlay --- .../InnerContent/views/innercontent.create.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/views/innercontent.create.html b/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/views/innercontent.create.html index 8b4f3a5..51d616d 100644 --- a/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/views/innercontent.create.html +++ b/src/Our.Umbraco.InnerContent/Web/UI/App_Plugins/InnerContent/views/innercontent.create.html @@ -1,5 +1,16 @@ 
+ +
Select a Content Type
Select a blueprint
@@ -8,8 +19,8 @@
Select