From 01c48b7dba6a5446e9571a355b0f19edf005ef1e Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 10 Jun 2013 15:49:35 -0200 Subject: [PATCH] Fixed content edit data issue and fixes media controller naming --- .../views/content/contentedit.controller.js | 43 +++++++++++-------- .../src/views/media/edit.controller.js | 26 +++++------ .../src/views/media/mediacreate.controller.js | 6 +-- 3 files changed, 42 insertions(+), 33 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/content/contentedit.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/contentedit.controller.js index 56e35b5821..8f8f193403 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/contentedit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/contentedit.controller.js @@ -1,22 +1,31 @@ angular.module("umbraco") .controller("Umbraco.Editors.ContentEditController", - function ($scope, $routeParams, contentResource, notificationsService) { - - if($routeParams.create) - $scope.content = contentResource.getContentScaffold($routeParams.id, $routeParams.doctype); - else - $scope.content = contentResource.getContent($routeParams.id); + function ($scope, $routeParams, contentResource, notificationsService) { + + if ($routeParams.create) { + + contentResource.getContentScaffold($routeParams.id, $routeParams.doctype) + .then(function (data) { + $scope.content = data; + }); + } + else { + contentResource.getContent($routeParams.id) + .then(function (data) { + $scope.content = data; + }); + } - $scope.saveAndPublish = function (cnt) { - cnt.publishDate = new Date(); - contentResource.publishContent(cnt); - notificationsService.success("Published", "Content has been saved and published"); - }; + $scope.saveAndPublish = function (cnt) { + cnt.publishDate = new Date(); + contentResource.publishContent(cnt); + notificationsService.success("Published", "Content has been saved and published"); + }; - $scope.save = function (cnt) { - cnt.updateDate = new Date(); - contentResource.saveContent(cnt); - notificationsService.success("Saved", "Content has been saved"); - }; -}); \ No newline at end of file + $scope.save = function (cnt) { + cnt.updateDate = new Date(); + contentResource.saveContent(cnt); + notificationsService.success("Saved", "Content has been saved"); + }; + }); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/media/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/media/edit.controller.js index d8a68a1714..4008fe03bf 100644 --- a/src/Umbraco.Web.UI.Client/src/views/media/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/media/edit.controller.js @@ -1,22 +1,22 @@ function mediaEditController($scope, $routeParams, contentResource, notificationsService) { - if ($routeParams.create) - $scope.content = contentResource.getContentScaffold($routeParams.id, $routeParams.doctype); - else - $scope.content = contentResource.getContent($routeParams.id); - - + if ($routeParams.create) + $scope.content = contentResource.getContentScaffold($routeParams.id, $routeParams.doctype); + else + $scope.content = contentResource.getContent($routeParams.id); + + $scope.saveAndPublish = function (cnt) { - cnt.publishDate = new Date(); - contentResource.publishContent(cnt); + cnt.publishDate = new Date(); + contentResource.publishContent(cnt); notificationsService.success("Published", "Content has been saved and published"); - }; - + }; + $scope.save = function (cnt) { - cnt.updateDate = new Date(); - contentResource.saveContent(cnt); + cnt.updateDate = new Date(); + contentResource.saveContent(cnt); notificationsService.success("Saved", "Content has been saved"); }; } angular.module("umbraco") - .controller("Umbraco.Editors.ContentEditController", mediaEditController); \ No newline at end of file + .controller("Umbraco.Editors.MediaEditController", mediaEditController); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/media/mediacreate.controller.js b/src/Umbraco.Web.UI.Client/src/views/media/mediacreate.controller.js index 0acf7aa5be..d474d1f620 100644 --- a/src/Umbraco.Web.UI.Client/src/views/media/mediacreate.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/media/mediacreate.controller.js @@ -1,6 +1,6 @@ -function mediaCreateController ($scope, $routeParams,contentTypeResource) { - $scope.allowedTypes = contentTypeResource.getAllowedTypes($scope.currentNode.id); +function mediaCreateController ($scope, $routeParams,contentTypeResource) { + $scope.allowedTypes = contentTypeResource.getAllowedTypes($scope.currentNode.id); } angular.module('umbraco') - .controller("Umbraco.Editors.ContentCreateController", mediaCreateController); \ No newline at end of file + .controller("Umbraco.Editors.MediaCreateController", mediaCreateController); \ No newline at end of file