moves the label switch a bit up the controller

This commit is contained in:
perploug
2013-10-30 23:02:50 +01:00
parent ea38f7a998
commit bfbed0249e

View File

@@ -8,12 +8,24 @@
*/
function ContentEditController($scope, $routeParams, $q, $timeout, $window, contentResource, navigationService, localizationService, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, fileManager, formHelper) {
contentResource.checkPermission("P", $routeParams.id).then(function(hasPermission){
var key = "buttons_sendToPublish"
if(hasPermission){
key = "buttons_saveAndPublish";
}
localizationService.localize(key).then(function(label){
$scope.publishButtonLabel = label;
});
});
if ($routeParams.create) {
//we are creating so get an empty content item
contentResource.getScaffold($routeParams.id, $routeParams.doctype)
.then(function(data) {
$scope.loaded = true;
$scope.content = data;
$scope.content = data;
});
}
else {
@@ -33,17 +45,6 @@ function ContentEditController($scope, $routeParams, $q, $timeout, $window, cont
serverValidationManager.executeAndClearAllSubscriptions();
contentResource.checkPermission("P", $routeParams.id).then(function(hasPermission){
var key = "buttons_sendToPublish"
if(hasPermission){
key = "buttons_saveAndPublish";
}
localizationService.localize(key).then(function(label){
$scope.publishButtonLabel = label;
});
});
});
}