Fixed content edit data issue and fixes media controller naming

This commit is contained in:
Shannon
2013-06-10 15:49:35 -02:00
parent 655a280cf1
commit 01c48b7dba
3 changed files with 42 additions and 33 deletions

View File

@@ -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");
};
});
$scope.save = function (cnt) {
cnt.updateDate = new Date();
contentResource.saveContent(cnt);
notificationsService.success("Saved", "Content has been saved");
};
});

View File

@@ -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);
.controller("Umbraco.Editors.MediaEditController", mediaEditController);

View File

@@ -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);
.controller("Umbraco.Editors.MediaCreateController", mediaCreateController);