Merge branch 'v8/8.17' into v9/feature/merge_v8.17-rc
This commit is contained in:
@@ -143,6 +143,9 @@
|
||||
const dropIndex = groupsInTab.findIndex(group => group.key === groupKey);
|
||||
|
||||
updateSortOrder(groupsInTab, dropIndex);
|
||||
|
||||
// when a group is dropped we need to reset the requested tab hover alias
|
||||
scope.sortableRequestedTabAlias = undefined;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -192,7 +195,9 @@
|
||||
const newAlias = contentTypeHelper.updateParentAlias(group.alias || null, hoveredTabAlias);
|
||||
// Check alias is unique
|
||||
if (group.alias !== newAlias && contentTypeHelper.isAliasUnique(scope.model.groups, newAlias) === false) {
|
||||
// TODO: Missing UI indication of why you cant move here.
|
||||
localizationService.localize("contentTypeEditor_groupReorderSameAliasError", [group.name, newAlias]).then((value) => {
|
||||
notificationsService.error(value);
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +90,9 @@ function contentTypeHelper(contentTypeResource, dataTypeResource, $filter, $inje
|
||||
},
|
||||
|
||||
convertGroupToTab: function (groups, group) {
|
||||
const tabs = groups.filter(group => group.type === this.TYPE_TAB).sort((a, b) => a.sortOrder - b.sortOrder);
|
||||
const nextSortOrder = tabs && tabs.length > 0 ? tabs[tabs.length - 1].sortOrder + 1 : 0;
|
||||
|
||||
group.convertingToTab = true;
|
||||
|
||||
group.type = this.TYPE_TAB;
|
||||
@@ -100,7 +103,7 @@ function contentTypeHelper(contentTypeResource, dataTypeResource, $filter, $inje
|
||||
|
||||
group.alias = this.isAliasUnique(otherGroups, newAlias) ? newAlias : this.createUniqueAlias(otherGroups, newAlias);
|
||||
group.parentAlias = null;
|
||||
|
||||
group.sortOrder = nextSortOrder;
|
||||
group.convertingToTab = false;
|
||||
},
|
||||
|
||||
|
||||
@@ -24,13 +24,19 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="umb-pane" ng-if="model.creatingFolder">
|
||||
<div class="umb-pane" ng-show="model.creatingFolder">
|
||||
<form novalidate name="createFolderForm"
|
||||
ng-submit="createContainer()"
|
||||
val-form-manager>
|
||||
|
||||
<umb-control-group label="Enter a folder name" hide-label="false">
|
||||
<input type="text" name="folderName" ng-model="model.folderName" class="umb-textstring textstring input-block-level" required umb-auto-focus />
|
||||
<input
|
||||
type="text"
|
||||
name="folderName"
|
||||
ng-model="model.folderName"
|
||||
class="umb-textstring textstring input-block-level"
|
||||
focus-when="{{model.creatingFolder}}"
|
||||
required />
|
||||
</umb-control-group>
|
||||
|
||||
<button type="submit" class="btn btn-primary"><localize key="general_create">Create</localize></button>
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="umb-pane" ng-if="model.creatingFolder">
|
||||
<div class="umb-pane" ng-show="model.creatingFolder">
|
||||
<form novalidate name="createFolderForm"
|
||||
ng-submit="createContainer()"
|
||||
val-form-manager>
|
||||
@@ -67,7 +67,14 @@
|
||||
</div>
|
||||
|
||||
<umb-control-group label="Enter a folder name" hide-label="false">
|
||||
<input type="text" name="folderName" maxlength="255" ng-model="model.folderName" class="umb-textstring textstring input-block-level" umb-auto-focus required />
|
||||
<input
|
||||
type="text"
|
||||
name="folderName"
|
||||
maxlength="255"
|
||||
ng-model="model.folderName"
|
||||
class="umb-textstring textstring input-block-level"
|
||||
focus-when="{{model.creatingFolder}}"
|
||||
required />
|
||||
</umb-control-group>
|
||||
|
||||
<button type="submit" class="btn btn-primary"><localize key="general_create">Create</localize></button>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="umb-pane" ng-if="model.creatingFolder">
|
||||
<div class="umb-pane" ng-show="model.creatingFolder">
|
||||
<form novalidate name="createFolderForm"
|
||||
ng-submit="createContainer()"
|
||||
val-form-manager>
|
||||
@@ -37,7 +37,13 @@
|
||||
</div>
|
||||
|
||||
<umb-control-group label="Enter a folder name" hide-label="false">
|
||||
<input type="text" name="folderName" ng-model="model.folderName" class="umb-textstring textstring input-block-level" umb-auto-focus required />
|
||||
<input
|
||||
type="text"
|
||||
name="folderName"
|
||||
ng-model="model.folderName"
|
||||
class="umb-textstring textstring input-block-level"
|
||||
focus-when="{{model.creatingFolder}}"
|
||||
required />
|
||||
</umb-control-group>
|
||||
|
||||
<button type="submit" class="btn btn-primary"><localize key="general_create">Create</localize></button>
|
||||
|
||||
@@ -173,13 +173,13 @@ describe('contentTypeHelper tests', function () {
|
||||
|
||||
describe('convertGroupToTab', function () {
|
||||
|
||||
const groups = [
|
||||
{ type: 0, alias: 'hero', name: 'Hero' },
|
||||
{ type: 0, alias: 'content' },
|
||||
{ type: 0, alias: 'footer' }
|
||||
];
|
||||
|
||||
it('should convert group to tab', function () {
|
||||
const groups = [
|
||||
{ type: 0, alias: 'hero', name: 'Hero' },
|
||||
{ type: 0, alias: 'content' },
|
||||
{ type: 0, alias: 'footer' }
|
||||
];
|
||||
|
||||
const newTab = groups[0];
|
||||
|
||||
contentTypeHelper.convertGroupToTab(groups, newTab);
|
||||
@@ -189,6 +189,29 @@ describe('contentTypeHelper tests', function () {
|
||||
expect(newTab.parentAlias).toBeNull();
|
||||
});
|
||||
|
||||
it('should set sort order to 0 if it is the first tab', function () {
|
||||
const groups = [
|
||||
{ type: 0, alias: 'hero', name: 'Hero' }
|
||||
];
|
||||
|
||||
const newTab = groups[0];
|
||||
contentTypeHelper.convertGroupToTab(groups, newTab);
|
||||
|
||||
expect(newTab.sortOrder).toBe(0);
|
||||
});
|
||||
|
||||
it('should set sort order to 1 higher than the last tab', function () {
|
||||
const groups = [
|
||||
{ type: 0, alias: 'settings', name: 'Settings', sortOrder: 100 },
|
||||
{ type: 1, alias: 'content', name: 'Content', sortOrder: 5 }
|
||||
];
|
||||
|
||||
const newTab = groups[0];
|
||||
contentTypeHelper.convertGroupToTab(groups, newTab);
|
||||
|
||||
expect(newTab.sortOrder).toBe(6);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user