Change exposed PropertyGroupType enum from int to string values
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div>
|
||||
<div>
|
||||
<ng-form name="tabbedContentForm">
|
||||
|
||||
<umb-editor-tab-bar ng-if="tabs.length > 0">
|
||||
@@ -29,13 +29,13 @@
|
||||
data-app-anchor="{{group.id}}"
|
||||
data-element="group-{{group.alias}}"
|
||||
ng-repeat="group in content.tabs track by group.key"
|
||||
ng-show="(group.parentAlias === activeTabAlias && group.type === 0) || tabs.length === 0">
|
||||
ng-show="(group.parentAlias === activeTabAlias && group.type === 'Group') || tabs.length === 0">
|
||||
|
||||
<div class="umb-group-panel__header">
|
||||
<div id="group-{{group.id}}">{{ group.label }}</div>
|
||||
</div>
|
||||
|
||||
<div class="umb-group-panel__content" data-element="tab-content-{{group.type === 0 ? group.parentAlias : group.alias}}">
|
||||
<div class="umb-group-panel__content" data-element="tab-content-{{group.type === 'Group' ? group.parentAlias : group.alias}}">
|
||||
<umb-property
|
||||
data-element="property-{{property.alias}}"
|
||||
ng-repeat="property in group.properties track by property.alias"
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
<div class="umb-group-panel"
|
||||
data-element="group-{{group.alias}}"
|
||||
ng-repeat="group in vm.model.variants[0].tabs track by group.key"
|
||||
ng-show="(group.parentAlias === vm.activeTabAlias && group.type === 0) || vm.tabs.length === 0">
|
||||
ng-show="(group.parentAlias === vm.activeTabAlias && group.type === 'Group') || vm.tabs.length === 0">
|
||||
|
||||
<div class="umb-group-panel__header">
|
||||
<div id="group-{{group.id}}">{{ group.label }}</div>
|
||||
</div>
|
||||
|
||||
<div class="umb-group-panel__content" data-element="tab-content-{{group.type === 0 ? group.parentAlias : group.alias}}">
|
||||
<div class="umb-group-panel__content" data-element="tab-content-{{group.type === 'Group' ? group.parentAlias : group.alias}}">
|
||||
<umb-property
|
||||
data-element="property-{{property.alias}}"
|
||||
ng-repeat="property in group.properties track by property.alias"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
contentTypeHelper.relocateDisorientedGroups(newValue);
|
||||
|
||||
vm.tabs = $filter("filter")(newValue, (tab) => {
|
||||
return tab.type === 1;
|
||||
return tab.type === contentTypeHelper.TYPE_TAB;
|
||||
});
|
||||
|
||||
if (vm.tabs.length > 0) {
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
<div class="umb-group-builder__groups" ui-sortable="sortableOptionsGroup" ng-model="model.groups">
|
||||
<div
|
||||
ng-repeat="(groupIndex, group) in model.groups track by group.key"
|
||||
ng-show="group.type === 0 && group.parentAlias === openTabAlias"
|
||||
ng-show="group.type === 'Group' && group.parentAlias === openTabAlias"
|
||||
ng-class="{'umb-group-builder__group-sortable': sortingMode && !group.inherited}"
|
||||
data-group-key="{{group.key}}">
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
sorting="sortingMode"
|
||||
on-change-sort-order-value="onChangeGroupSortOrderValue(group)"
|
||||
val-server-field-name="{{'Groups[' + group.serverValidationIndex + '].Name'}}"
|
||||
val-tab-alias="tab-content-{{group.type === 0 ? group.parentAlias : group.alias}}">
|
||||
val-tab-alias="tab-content-{{group.type === 'Group' ? group.parentAlias : group.alias}}">
|
||||
|
||||
<ul class="umb-group-builder__properties" ui-sortable="sortableOptionsProperty" ng-model="group.properties" ng-show="group.properties.length > 0 || sortingMode">
|
||||
<li ng-repeat="(propertyIndex, property) in group.properties track by propertyIndex" ng-class="{'umb-group-builder__property-sortable': sortingMode && !property.inherited}">
|
||||
@@ -162,7 +162,7 @@
|
||||
on-change-sort-order-value="onChangePropertySortOrderValue(group)"
|
||||
val-server-field-alias="{{'Groups[' + group.serverValidationIndex + '].Properties[' + propertyIndex + '].Alias'}}"
|
||||
val-server-field-label="{{'Groups[' + group.serverValidationIndex + '].Properties[' + propertyIndex + '].Label'}}"
|
||||
val-tab-alias="tab-content-{{group.type === 0 ? group.parentAlias : group.alias}}">
|
||||
val-tab-alias="tab-content-{{group.type === 'Group' ? group.parentAlias : group.alias}}">
|
||||
</umb-content-type-property>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
contentTypeHelper.relocateDisorientedGroups(newValue);
|
||||
|
||||
vm.tabs = $filter("filter")(newValue, (tab) => {
|
||||
return tab.type === 1;
|
||||
return tab.type === contentTypeHelper.TYPE_TAB;
|
||||
});
|
||||
|
||||
if (vm.tabs.length > 0) {
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
class="umb-group-panel"
|
||||
data-element="group-{{group.alias}}"
|
||||
ng-repeat="group in content.tabs | filter: { hide : '!' + true } track by group.id"
|
||||
ng-show="(group.parentAlias === vm.activeTabAlias && group.type === 0) || vm.tabs.length === 0">
|
||||
ng-show="(group.parentAlias === vm.activeTabAlias && group.type === 'Group') || vm.tabs.length === 0">
|
||||
|
||||
<div class="umb-group-panel__header">
|
||||
<div>{{ group.label }}</div>
|
||||
</div>
|
||||
|
||||
<div class="umb-group-panel__content" data-element="tab-content-{{group.type === 0 ? group.parentAlias : group.alias}}">
|
||||
<div class="umb-group-panel__content" data-element="tab-content-{{group.type === 'Group' ? group.parentAlias : group.alias}}">
|
||||
<umb-property
|
||||
data-element="property-{{property.alias}}"
|
||||
ng-repeat="property in group.properties"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
contentTypeHelper.relocateDisorientedGroups(newValue);
|
||||
|
||||
vm.tabs = $filter("filter")(newValue, (tab) => {
|
||||
return tab.type === 1;
|
||||
return tab.type === contentTypeHelper.TYPE_TAB;
|
||||
});
|
||||
|
||||
if (vm.tabs.length > 0) {
|
||||
|
||||
@@ -21,13 +21,13 @@
|
||||
class="umb-group-panel"
|
||||
data-element="group-{{group.alias}}"
|
||||
ng-repeat="group in content.tabs"
|
||||
ng-show="(group.parentAlias === vm.activeTabAlias && group.type === 0) || vm.tabs.length === 0">
|
||||
ng-show="(group.parentAlias === vm.activeTabAlias && group.type === 'Group') || vm.tabs.length === 0">
|
||||
|
||||
<div class="umb-group-panel__header">
|
||||
<div>{{ group.label }}</div>
|
||||
</div>
|
||||
|
||||
<div class="umb-group-panel__content" data-element="tab-content-{{group.type === 0 ? group.parentAlias : group.alias}}">
|
||||
<div class="umb-group-panel__content" data-element="tab-content-{{group.type === 'Group' ? group.parentAlias : group.alias}}">
|
||||
<umb-property
|
||||
data-element="property-{{group.alias}}"
|
||||
ng-repeat="property in group.properties | filter:vm.hideSystemProperties track by property.alias"
|
||||
|
||||
@@ -19,14 +19,14 @@ describe('contentTypeHelper tests', function () {
|
||||
describe('Group type', function () {
|
||||
it('should return the group type', function () {
|
||||
var groupType = contentTypeHelper.TYPE_GROUP;
|
||||
expect(groupType).toBe(0);
|
||||
expect(groupType).toBe('Group');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Tab type', function () {
|
||||
it('should return the tab type', function () {
|
||||
var tabType = contentTypeHelper.TYPE_TAB;
|
||||
expect(tabType).toBe(1);
|
||||
expect(tabType).toBe('Tab');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user