enabling opening a parent composition type

This commit is contained in:
Niels Lyngsø
2021-08-04 10:14:07 +02:00
parent c97073b414
commit fac303b274
6 changed files with 25 additions and 9 deletions

View File

@@ -4,7 +4,7 @@
/**
* A component to render the content type group
*/
function umbContentTypeGroupController() {
const vm = this;
@@ -14,6 +14,7 @@
vm.whenNameFocus = whenNameFocus;
vm.whenFocus = whenFocus;
vm.changeSortOrderValue = changeSortOrderValue;
vm.clickComposition = clickComposition;
function updateName (group) {
if (vm.onUpdateName) {
@@ -44,6 +45,11 @@
vm.onChangeSortOrderValue( {group: vm.group});
}
}
function clickComposition (documentTypeId) {
if (vm.onClickComposition) {
vm.onClickComposition({documentTypeId: documentTypeId});
}
}
}
const umbContentTypeGroupComponent = {
@@ -61,7 +67,8 @@
onFocus: '&',
onChangeSortOrderValue: '&',
valServerFieldName: '@',
valTabAlias: "@"
valTabAlias: "@",
onClickComposition: '&?'
},
controller: umbContentTypeGroupController
};

View File

@@ -15,6 +15,7 @@
vm.whenFocus = whenFocus;
vm.changeSortOrderValue = changeSortOrderValue;
vm.changeName = changeName;
vm.clickComposition = clickComposition;
function click () {
if (vm.onClick) {
@@ -51,6 +52,11 @@
vm.onChangeName({ key: vm.tab.key, name: vm.tab.name });
}
}
function clickComposition (documentTypeId) {
if (vm.onClickComposition) {
vm.onClickComposition({documentTypeId: documentTypeId});
}
}
}
@@ -61,6 +67,7 @@
bindings: {
tab: '<',
onClick: '&?',
onClickComposition: '&?',
isOpen: '<?',
allowRemove: '<?',
onRemove: '&?',

View File

@@ -424,7 +424,7 @@
};
scope.openDocumentType = documentTypeId => {
scope.openDocumentType = (documentTypeId) => {
const editor = {
id: documentTypeId,
submit: () => {

View File

@@ -31,7 +31,7 @@
<i class="icon icon-merge"></i>
<localize key="contentTypeEditor_inheritedFrom"></localize>: {{ vm.group.inheritedFromName }}
<span ng-repeat="contentTypeName in vm.group.parentTabContentTypeNames">
<button type="button" class="btn-link btn-small p0" ng-click="openDocumentType(vm.group.parentTabContentTypes[$index])">{{ contentTypeName }}</button>
<button type="button" class="btn-link btn-small p0" ng-click="vm.clickComposition(vm.group.parentTabContentTypes[$index])">{{ contentTypeName }}</button>
<span ng-if="!$last">, </span>
</span>
</div>
@@ -56,4 +56,4 @@
<div class="umb-group-builder__group-content">
<ng-transclude></ng-transclude>
</div>
</div>
</div>

View File

@@ -3,7 +3,7 @@
<div class="umb-group-builder__tab-inherited-label" ng-if="vm.tab.inherited">
<localize key="contentTypeEditor_inheritedFrom"></localize>: {{ vm.tab.inheritedFromName }}
<span ng-repeat="contentTypeName in vm.tab.parentTabContentTypeNames">
<button type="button" class="btn-link btn-small p0" ng-click="openDocumentType(vm.tab.parentTabContentTypes[$index])">{{ contentTypeName }}</button>
<button type="button" class="btn-link btn-small p0" ng-click="vm.clickComposition(vm.tab.parentTabContentTypes[$index])">{{ contentTypeName }}</button>
<span ng-if="!$last">, </span>
</span>
</div>
@@ -28,7 +28,7 @@
val-server-field="{{ vm.valServerFieldName }}"
data-lpignore="true"
required />
<div class="umb-group-builder__tab-val-message" ng-messages="tabNameForm.tabName.$error" show-validation-on-submit>
<div class="umb-validation-label -arrow-bottom" ng-message="valServerField">{{tabNameForm.tabName.errorMsg}}</div>
<div class="umb-validation-label -arrow-bottom" ng-message="required"><localize key="required"></localize></div>
@@ -52,7 +52,7 @@
</div>
<div class="umb-group-builder__tab-remove" ng-if="vm.allowRemove">
<button type="button" class="btn-reset" ng-click="vm.removeTab()">
<i class="icon-trash"></i>
<i cass="icon-trash"></i>
</button>
</div>
</div>
</div>

View File

@@ -22,6 +22,7 @@
tab="tab"
is-open="tab.alias === openTabAlias"
on-click="changeTab(tab)"
on-click-composition="openDocumentType(documentTypeId)"
sorting="sortingMode"
allow-remove="canRemoveTab(tab) && !sortingMode"
on-remove="removeTab(tab, tabIndex)"
@@ -129,6 +130,7 @@
allow-name="true"
group="group"
allow-remove="canRemoveGroup(group) && !sortingMode"
on-click-composition="openDocumentType(documentTypeId)"
on-remove="removeGroup(group)"
on-update-name="onChangeGroupName(group)"
sorting="sortingMode"