From a4b24bf19806ede3850a0c178d5f50710904bb7c Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 30 Apr 2018 16:23:32 +0200 Subject: [PATCH] Content language picker now contains (if needed) Draft state to be consistent with the Publish dialog --- .../editor/umbeditorheader.directive.js | 16 ++++++++++++++-- .../overlays/publish/publish.controller.js | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorheader.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorheader.directive.js index 6a15b0baba..1e9c1376a6 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorheader.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorheader.directive.js @@ -213,11 +213,15 @@ Use this directive to construct a header inside the main editor window. scope.vm.currentVariant = ""; function onInit() { + setVariantDraftState(scope.variants); + setCurrentVariant(scope.variants); setVariantStatusColor(scope.variants); } function setCurrentVariant(variants) { + setVariantDraftState(variants); + angular.forEach(variants, function (variant) { if(variant.current) { scope.vm.currentVariant = variant; @@ -245,8 +249,16 @@ Use this directive to construct a header inside the main editor window. }); } - scope.goBack = function() { - if(scope.onBack) { + function setVariantDraftState(variants) { + _.each(variants, function (variant) { + if (variant.isEdited === true && !variant.state.includes("Draft")) { + variant.state += ", Draft"; + } + }); + } + + scope.goBack = function () { + if (scope.onBack) { scope.onBack(); } }; diff --git a/src/Umbraco.Web.UI.Client/src/views/common/overlays/publish/publish.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/overlays/publish/publish.controller.js index c0e457e0b9..081a923d4e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/overlays/publish/publish.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/overlays/publish/publish.controller.js @@ -1,7 +1,7 @@ (function () { "use strict"; - function PublishController($scope, eventsService) { + function PublishController($scope) { var vm = this; var variants = $scope.model.variants;