diff --git a/src/Umbraco.Core/Models/ContentEditing/Tab.cs b/src/Umbraco.Core/Models/ContentEditing/Tab.cs index f8e80a1bdb..eda5abb2c3 100644 --- a/src/Umbraco.Core/Models/ContentEditing/Tab.cs +++ b/src/Umbraco.Core/Models/ContentEditing/Tab.cs @@ -17,7 +17,7 @@ namespace Umbraco.Cms.Core.Models.ContentEditing public Guid Key { get; set; } [DataMember(Name = "type")] - public int Type { get; set; } + public string Type { get; set; } [DataMember(Name = "active")] public bool IsActive { get; set; } diff --git a/src/Umbraco.Core/Models/Mapping/ContentPropertyMapDefinition.cs b/src/Umbraco.Core/Models/Mapping/ContentPropertyMapDefinition.cs index 11aad3ea20..270d821380 100644 --- a/src/Umbraco.Core/Models/Mapping/ContentPropertyMapDefinition.cs +++ b/src/Umbraco.Core/Models/Mapping/ContentPropertyMapDefinition.cs @@ -37,7 +37,7 @@ namespace Umbraco.Cms.Core.Models.Mapping { target.Id = source.Id; target.Key = source.Key; - target.Type = (int)source.Type; + target.Type = source.Type.ToString(); target.Label = source.Name; target.Alias = source.Alias; target.IsActive = true; diff --git a/src/Umbraco.Core/Models/Mapping/TabsAndPropertiesMapper.cs b/src/Umbraco.Core/Models/Mapping/TabsAndPropertiesMapper.cs index 28003b9c35..803f5aa3f0 100644 --- a/src/Umbraco.Core/Models/Mapping/TabsAndPropertiesMapper.cs +++ b/src/Umbraco.Core/Models/Mapping/TabsAndPropertiesMapper.cs @@ -158,7 +158,7 @@ namespace Umbraco.Cms.Core.Models.Mapping { Id = g.Id, Key = g.Key, - Type = (int)g.Type, + Type = g.Type.ToString(), Alias = g.Alias, Label = LocalizedTextService.UmbracoDictionaryTranslate(CultureDictionary, g.Name), Properties = mappedProperties diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbtabbedcontent.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbtabbedcontent.directive.js index ed6d34873c..97b5f4fcd3 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbtabbedcontent.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbtabbedcontent.directive.js @@ -1,4 +1,4 @@ -(function () { +(function () { 'use strict'; /** This directive is used to render out the current variant tabs and properties and exposes an API for other directives to consume */ @@ -23,7 +23,7 @@ // make a collection with only tabs and not all groups $scope.tabs = $filter("filter")(newValue, (tab) => { - return tab.type === 1; + return tab.type === contentTypeHelper.TYPE_TAB; }); if ($scope.tabs.length > 0) { diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorcontentheader.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorcontentheader.directive.js index e43b84c5ab..e194d00295 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorcontentheader.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorcontentheader.directive.js @@ -1,7 +1,7 @@ (function () { 'use strict'; - function EditorContentHeader(serverValidationManager, localizationService, editorState, contentEditingHelper) { + function EditorContentHeader(serverValidationManager, localizationService, editorState, contentEditingHelper, contentTypeHelper) { function link(scope) { var unsubscribe = []; @@ -137,7 +137,7 @@ scope.editor.variantApps.forEach((app) => { // only render quick links on the content app if there are no tabs if (app.alias === "umbContent") { - const hasTabs = scope.editor.content.tabs && scope.editor.content.tabs.filter(group => group.type === 1).length > 0; + const hasTabs = scope.editor.content.tabs && scope.editor.content.tabs.filter(group => group.type === contentTypeHelper.TYPE_TAB).length > 0; app.anchors = hasTabs ? [] : scope.editor.content.tabs; } }); diff --git a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js index 33214d6032..0d8d5c782a 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js @@ -5,7 +5,7 @@ * @description A helper service for most editors, some methods are specific to content/media/member model types but most are used by * all editors to share logic and reduce the amount of replicated code among editors. **/ -function contentEditingHelper(fileManager, $q, $location, $routeParams, editorState, notificationsService, navigationService, localizationService, serverValidationManager, formHelper) { +function contentEditingHelper(fileManager, $q, $location, $routeParams, editorState, notificationsService, navigationService, localizationService, serverValidationManager, formHelper, contentTypeHelper) { function isValidIdentifier(id) { @@ -190,7 +190,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, editorSt return; } - const isRootGroup = (group) => group.type === 0 && group.parentAlias === null; + const isRootGroup = (group) => group.type === contentTypeHelper.TYPE_GROUP && group.parentAlias === null; const hasRootGroups = groups.filter(group => isRootGroup(group)).length > 0; if (!hasRootGroups) { return; @@ -198,7 +198,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, editorSt const genericTab = { isGenericTab: true, - type: 1, + type: contentTypeHelper.TYPE_TAB, label: 'Generic', key: String.CreateGuid(), alias: null, diff --git a/src/Umbraco.Web.UI.Client/src/common/services/contenttypehelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/contenttypehelper.service.js index c940ed0d71..a5298aa425 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/contenttypehelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/contenttypehelper.service.js @@ -7,8 +7,8 @@ function contentTypeHelper(contentTypeResource, dataTypeResource, $filter, $inje var contentTypeHelperService = { - TYPE_GROUP: 0, - TYPE_TAB: 1, + TYPE_GROUP: 'Group', + TYPE_TAB: 'Tab', isAliasUnique(groups, alias) { return groups.find(group => group.alias === alias) ? false : true; diff --git a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html index e742e32f8c..1b736490da 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html @@ -1,4 +1,4 @@ -