Content type picker in dynamic root pickers (#15514)

This commit is contained in:
Bjarne Fyrstenborg
2024-02-14 12:34:18 +01:00
committed by GitHub
parent 43e373d352
commit 8145a90094
4 changed files with 76 additions and 47 deletions

View File

@@ -3,31 +3,32 @@
function PickDynamicRootCustomStepController($scope, localizationService) {
var vm = this;
const vm = this;
vm.submit = submit;
vm.close = close;
function onInit() {
if(!$scope.model.title) {
localizationService.localize("dynamicRoot_pickDynamicRootQueryStepTitle").then(function(value){
if (!$scope.model.title) {
localizationService.localize("dynamicRoot_pickDynamicRootQueryStepTitle").then(value => {
$scope.model.title = value;
});
}
if(!$scope.model.subtitle) {
localizationService.localize("dynamicRoot_pickDynamicRootQueryStepDesc").then(function(value){
if (!$scope.model.subtitle) {
localizationService.localize("dynamicRoot_pickDynamicRootQueryStepDesc").then(value => {
$scope.model.subtitle = value;
});
}
}
vm.submit = submit;
function submit() {
if ($scope.model.submit) {
$scope.model.submit($scope.model);
}
}
vm.close = close;
function close() {
if($scope.model.close) {
if ($scope.model.close) {
$scope.model.close();
}
}

View File

@@ -3,48 +3,59 @@
function PickDynamicRootOriginController($scope, localizationService, editorService, udiParser) {
var vm = this;
const vm = this;
vm.chooseRoot = chooseRoot;
vm.chooseParent = chooseParent;
vm.chooseCurrent = chooseCurrent;
vm.chooseSite = chooseSite;
vm.chooseByKey = chooseByKey;
vm.submit = submit;
vm.close = close;
function onInit() {
if(!$scope.model.title) {
localizationService.localize("dynamicRoot_pickDynamicRootOriginTitle").then(function(value){
if (!$scope.model.title) {
localizationService.localize("dynamicRoot_pickDynamicRootOriginTitle").then(value => {
$scope.model.title = value;
});
}
if(!$scope.model.subtitle) {
localizationService.localize("dynamicRoot_pickDynamicRootOriginDesc").then(function(value){
if (!$scope.model.subtitle) {
localizationService.localize("dynamicRoot_pickDynamicRootOriginDesc").then(value => {
$scope.model.subtitle = value;
});
}
}
vm.chooseRoot = function() {
function chooseRoot() {
$scope.model.value.originAlias = "Root";
$scope.model.value.originKey = null;
vm.submit($scope.model);
}
vm.chooseParent = function() {
function chooseParent() {
$scope.model.value.originAlias = "Parent";
$scope.model.value.originKey = null;
vm.submit($scope.model);
}
vm.chooseCurrent = function() {
function chooseCurrent() {
$scope.model.value.originAlias = "Current";
$scope.model.value.originKey = null;
vm.submit($scope.model);
}
vm.chooseSite = function() {
function chooseSite() {
$scope.model.value.originAlias = "Site";
$scope.model.value.originKey = null;
vm.submit($scope.model);
}
vm.chooseByKey = function() {
var treePicker = {
function chooseByKey() {
const editor = {
idType: "udi",
section: $scope.model.contentType,
treeAlias: $scope.model.contentType,
multiPicker: false,
submit: function(model) {
var item = model.selection[0];
@@ -57,19 +68,28 @@
editorService.close();
}
};
editorService.treePicker(treePicker);
}
vm.submit = submit;
switch ($scope.model.contentType) {
case "content":
editorService.contentPicker(editor);
break;
case "media":
editorService.mediaPicker(editor);
break;
case "member":
editorService.memberPicker(editor);
break;
}
}
function submit(model) {
if ($scope.model.submit) {
$scope.model.submit(model);
}
}
vm.close = close;
function close() {
if($scope.model.close) {
if ($scope.model.close) {
$scope.model.close();
}
}

View File

@@ -3,23 +3,29 @@
function PickDynamicRootQueryStepController($scope, localizationService, editorService, udiParser) {
var vm = this;
const vm = this;
vm.choose = choose;
vm.chooseCustom = chooseCustom;
vm.submit = submit;
vm.close = close;
function onInit() {
if(!$scope.model.title) {
localizationService.localize("dynamicRoot_pickDynamicRootQueryStepTitle").then(function(value){
if (!$scope.model.title) {
localizationService.localize("dynamicRoot_pickDynamicRootQueryStepTitle").then(value => {
$scope.model.title = value;
});
}
if(!$scope.model.subtitle) {
localizationService.localize("dynamicRoot_pickDynamicRootQueryStepDesc").then(function(value){
if (!$scope.model.subtitle) {
localizationService.localize("dynamicRoot_pickDynamicRootQueryStepDesc").then(value => {
$scope.model.subtitle = value;
});
}
}
vm.choose = function(queryStepAlias) {
var editor = {
function choose(queryStepAlias) {
const editor = {
multiPicker: true,
filterCssClass: "not-allowed not-published",
filter: function (item) {
@@ -42,16 +48,18 @@
switch ($scope.model.contentType) {
case "content":
editorService.contentTypePicker(editor);
editor.entityType = "documentType";
break;
case "media":
editorService.mediaTypePicker(editor);
editor.entityType = "mediaType";
break;
}
editorService.contentTypePicker(editor);
}
vm.chooseCustom = function() {
var customStepPicker = {
function chooseCustom() {
const customStepPicker = {
view: "views/common/infiniteeditors/pickdynamicrootcustomstep/pickdynamicrootcustomstep.html",
size: "small",
value: "",
@@ -68,17 +76,15 @@
};
editorService.open(customStepPicker);
}
vm.submit = submit;
function submit(model) {
if ($scope.model.submit) {
$scope.model.submit(model);
}
}
vm.close = close;
function close() {
if($scope.model.close) {
if ($scope.model.close) {
$scope.model.close();
}
}

View File

@@ -39,7 +39,7 @@ function TreeSourceTypePickerController($scope, contentTypeResource, mediaTypeRe
return;
}
var editor = {
const editor = {
multiPicker: true,
filterCssClass: "not-allowed not-published",
filter: function (item) {
@@ -62,15 +62,17 @@ function TreeSourceTypePickerController($scope, contentTypeResource, mediaTypeRe
switch (currentItemType) {
case "content":
editorService.contentTypePicker(editor);
editor.entityType = "documentType";
break;
case "media":
editorService.mediaTypePicker(editor);
editor.entityType = "mediaType";
break;
case "member":
editorService.memberTypePicker(editor);
editor.entityType = "memberType";
break;
}
editorService.contentTypePicker(editor);
}
function remove(itemType) {