use editorService to open copy dialog

This commit is contained in:
Mads Rasmussen
2018-08-20 15:54:36 +02:00
parent 7ffa4969b9
commit 880eff5e71
3 changed files with 38 additions and 30 deletions

View File

@@ -102,6 +102,26 @@
open(editor);
}
/**
* @ngdoc method
* @name umbraco.services.editorService#copy
* @methodOf umbraco.services.editorService
*
* @description
* Opens a copy editor in infinite editing, the submit callback returns an array of selected items
* @param {String} editor.section The node entity type
* @param {String} editor.currentNode The current node id
* @param {Callback} editor.submit Saves, submits, and closes the editor
* @param {Callback} editor.close Closes the editor
* @returns {Object} editor object
*/
function copy(editor) {
editor.view = "views/common/infiniteeditors/copy/copy.html";
editor.size = "small";
open(editor);
}
/**
* @ngdoc method
* @name umbraco.services.editorService#mediaEditor
@@ -363,6 +383,7 @@
mediaEditor: mediaEditor,
contentEditor: contentEditor,
contentPicker: contentPicker,
copy: copy,
mediaPicker: mediaPicker,
iconPicker: iconPicker,
documentTypeEditor: documentTypeEditor,

View File

@@ -1,4 +1,4 @@
function listViewController($rootScope, $scope, $routeParams, $injector, currentUserResource, notificationsService, iconHelper, dialogService, editorState, localizationService, $location, appState, $timeout, $q, mediaResource, listViewHelper, userService, navigationService, treeService) {
function listViewController($scope, $routeParams, $injector, currentUserResource, notificationsService, iconHelper, editorState, localizationService, appState, $timeout, mediaResource, listViewHelper, navigationService, editorService) {
//this is a quick check to see if we're in create mode, if so just exit - we cannot show children for content
// that isn't created yet, if we continue this will use the parent id in the route params which isn't what
@@ -498,28 +498,22 @@ function listViewController($rootScope, $scope, $routeParams, $injector, current
});
}
$scope.copy = function () {
$scope.copyDialog = {};
$scope.copyDialog.section = $scope.entityType;
$scope.copyDialog.currentNode = $scope.contentId;
$scope.copyDialog.view = "copy";
$scope.copyDialog.show = true;
$scope.copyDialog.submit = function (model) {
if (model.target) {
performCopy(model.target, model.relateToOriginal);
}
$scope.copyDialog.show = false;
$scope.copyDialog = null;
};
$scope.copyDialog.close = function (oldModel) {
$scope.copyDialog.show = false;
$scope.copyDialog = null;
};
};
$scope.copy = function () {
var copyEditor = {
section: $scope.entityType,
currentNode: $scope.contentId,
submit: function(model) {
if (model.target) {
performCopy(model.target, model.relateToOriginal);
}
editorService.close();
},
close: function() {
editorService.close();
}
};
editorService.copy(copyEditor);
};
function performCopy(target, relateToOriginal) {
applySelected(

View File

@@ -181,13 +181,6 @@
view="moveDialog.view">
</umb-overlay>
<umb-overlay
ng-if="copyDialog.show"
model="copyDialog"
position="right"
view="copyDialog.view">
</umb-overlay>
<umb-overlay
ng-if="ysodOverlay.show"
model="ysodOverlay"