Can change content node variants trough routeParams (languageId)

This commit is contained in:
Robert
2018-04-10 11:50:37 +02:00
parent 8d654e3630
commit aba0b0448d
3 changed files with 13 additions and 10 deletions

View File

@@ -1,7 +1,10 @@
(function () {
'use strict';
function ContentEditController($rootScope, $scope, $routeParams, $q, $timeout, $window, $location, appState, contentResource, entityResource, navigationService, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, treeService, fileManager, formHelper, umbRequestHelper, keyboardService, umbModelMapper, editorState, $http, eventsService, relationResource, overlayService) {
function ContentEditController($rootScope, $scope, $routeParams, $q, $timeout, $window, $location,
appState, contentResource, entityResource, navigationService, notificationsService, angularHelper,
serverValidationManager, contentEditingHelper, treeService, fileManager, formHelper, umbRequestHelper,
keyboardService, umbModelMapper, editorState, $http, eventsService, relationResource, overlayService) {
var evts = [];
@@ -17,6 +20,7 @@
$scope.page.listViewPath = null;
$scope.page.isNew = $scope.isNew ? true : false;
$scope.page.buttonGroupState = "init";
$scope.page.languageId = $scope.languageId;
$scope.allowOpen = true;
// add all editors to an editors array to support split view
@@ -109,7 +113,7 @@
$scope.editors.push(editor);
}
else if ($scope.editors.length === 1) {
$scope.editors[0].content = $scope.content
$scope.editors[0].content = $scope.content;
}
else {
//fixme - need to fix something here if we are re-loading a content item that is in a split view
@@ -258,11 +262,11 @@
}
else {
getNode();
//Browse content nodes based on the selected tree language variant
$scope.page.languageId ? getNode($scope.languageId) : getNode();
}
$scope.unPublish = function () {
if (formHelper.submitForm({ scope: $scope, statusMessage: "Unpublishing...", skipValidation: true })) {
@@ -402,8 +406,6 @@
$scope.page.buttonRestore = "error";
notificationsService.error(error.headline, error.content);
});
};
$scope.selectVariant = function (variant, variants, form) {
@@ -527,7 +529,8 @@
page: "=?",
saveMethod: "&",
getMethod: "&",
getScaffoldMethod: "&?"
getScaffoldMethod: "&?",
languageId: "=?"
}
};

View File

@@ -8,8 +8,6 @@
*/
function ContentEditController($scope, $routeParams, contentResource) {
function scaffoldEmpty() {
return contentResource.getScaffold($routeParams.id, $routeParams.doctype);
}
@@ -23,6 +21,7 @@ function ContentEditController($scope, $routeParams, contentResource) {
$scope.getScaffoldMethod = $routeParams.blueprintId ? scaffoldBlueprint : scaffoldEmpty;
$scope.page = $routeParams.page;
$scope.isNew = $routeParams.create;
$scope.languageId = $routeParams.languageId;
}
angular.module("umbraco").controller("Umbraco.Editors.Content.EditController", ContentEditController);

View File

@@ -6,6 +6,7 @@
get-method="getMethod"
get-scaffold-method="getScaffoldMethod"
tree-alias="content"
is-new="isNew">
is-new="isNew"
language-id="languageId">
</content-editor>
</div>