diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js index 45b696edb2..a73264b0f0 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js @@ -84,6 +84,49 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) { 'Failed to sort content'); }, + /** + * @ngdoc method + * @name umbraco.resources.contentResource#sort + * @methodOf umbraco.resources.contentResource + * + * @description + * Sorts all children below a given parent node id, based on a collection of node-ids + * + * ##usage + *
+ * contentResource.move({ parentId: 1244, id: 123 })
+ * .then(function() {
+ * alert("node was moved");
+ * }, function(err){
+ * alert("node didnt move:" + err);
+ * });
+ *
+ * @param {Object} args arguments object
+ * @param {Int} args.idd the ID of the node to move
+ * @param {Int} args.parentId the ID of the parent node to move to
+ * @returns {Promise} resourcePromise object.
+ *
+ */
+ move: function (args) {
+ if (!args) {
+ throw "args cannot be null";
+ }
+ if (!args.parentId) {
+ throw "args.parentId cannot be null";
+ }
+ if (!args.id) {
+ throw "args.id cannot be null";
+ }
+
+ return umbRequestHelper.resourcePromise(
+ $http.post(umbRequestHelper.getApiUrl("contentApiBaseUrl", "PostMove"),
+ {
+ parentId: args.parentId,
+ id: args.id
+ }),
+ 'Failed to move content');
+ },
+
/**
* @ngdoc method
* @name umbraco.resources.contentResource#emptyRecycleBin