From eafbf6dcaeecc981748b7f6dafb4c9e9717f8eab Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 10 Jan 2019 12:07:53 +0100 Subject: [PATCH 1/2] Update current urls on 'node.updateDate' --- .../content/umbcontentnodeinfo.directive.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js index f2e8b261c3..46afc77d02 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js @@ -22,14 +22,7 @@ // set currentVariant scope.currentVariant = _.find(scope.node.variants, (v) => v.active); - // find the urls for the currently selected language - if(scope.node.variants.length > 1) { - // nodes with variants - scope.currentUrls = _.filter(scope.node.urls, (url) => scope.currentVariant.language.culture === url.culture); - } else { - // invariant nodes - scope.currentUrls = scope.node.urls; - } + updateCurrentUrls(); // if there are any infinite editors open we are in infinite editing scope.isInfiniteMode = editorService.getNumberOfEditors() > 0 ? true : false; @@ -304,6 +297,17 @@ }); } + function updateCurrentUrls() { + // find the urls for the currently selected language + if (scope.node.variants.length > 1) { + // nodes with variants + scope.currentUrls = _.filter(scope.node.urls, (url) => scope.currentVariant.language.culture === url.culture); + } else { + // invariant nodes + scope.currentUrls = scope.node.urls; + } + } + // load audit trail and redirects when on the info tab evts.push(eventsService.on("app.tabChange", function (event, args) { $timeout(function () { @@ -328,6 +332,7 @@ loadAuditTrail(); loadRedirectUrls(); setNodePublishStatus(); + updateCurrentUrls(); } }); From b000ead96be631c9474606d7adf4eaf8edbb64c5 Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 10 Jan 2019 12:09:44 +0100 Subject: [PATCH 2/2] CTRL+K+D --- .../content/umbcontentnodeinfo.directive.js | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js index 46afc77d02..71fbabe943 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbcontentnodeinfo.directive.js @@ -3,7 +3,7 @@ function ContentNodeInfoDirective($timeout, logResource, eventsService, userService, localizationService, dateHelper, editorService, redirectUrlsResource, overlayService) { - function link(scope, element, attrs, umbVariantContentCtrl) { + function link(scope, umbVariantContentCtrl) { var evts = []; var isInfoTab = false; @@ -27,7 +27,7 @@ // if there are any infinite editors open we are in infinite editing scope.isInfiniteMode = editorService.getNumberOfEditors() > 0 ? true : false; - userService.getCurrentUser().then(function(user){ + userService.getCurrentUser().then(function (user) { // only allow change of media type if user has access to the settings sections const hasAccessToSettings = user.allowedSections.indexOf("settings") !== -1 ? true : false; scope.allowChangeDocumentType = hasAccessToSettings; @@ -35,8 +35,8 @@ }); var keys = [ - "general_deleted", - "content_unpublished", + "general_deleted", + "content_unpublished", "content_published", "content_publishedPendingChanges", "content_notCreated", @@ -48,7 +48,7 @@ ]; localizationService.localizeMany(keys) - .then(function(data){ + .then(function (data) { labels.deleted = data[0]; labels.unpublished = data[1]; //aka draft labels.published = data[2]; @@ -57,9 +57,9 @@ labels.unsavedChanges = data[5]; labels.doctypeChangeWarning = data[6]; labels.notPublished = data[9]; - + scope.historyLabel = scope.node.variants && scope.node.variants.length === 1 ? data[7] : data[8]; - + setNodePublishStatus(); if (scope.currentUrls.length === 0) { @@ -116,23 +116,23 @@ scope.openDocumentType = function (documentType) { - const variantIsDirty = _.some(scope.node.variants, function(variant) { + const variantIsDirty = _.some(scope.node.variants, function (variant) { return variant.isDirty; }); // add confirmation dialog before opening the doc type editor - if(variantIsDirty) { + if (variantIsDirty) { const confirm = { title: labels.unsavedChanges, view: "default", content: labels.doctypeChangeWarning, submitButtonLabelKey: "general_continue", closeButtonLabelKey: "general_cancel", - submit: function() { + submit: function () { openDocTypeEditor(documentType); overlayService.close(); }, - close: function() { + close: function () { overlayService.close(); } }; @@ -146,12 +146,12 @@ function openDocTypeEditor(documentType) { const editor = { id: documentType.id, - submit: function(model) { + submit: function (model) { const args = { node: scope.node }; eventsService.emit('editors.content.reload', args); editorService.close(); }, - close: function() { + close: function () { editorService.close(); } }; @@ -161,10 +161,10 @@ scope.openTemplate = function () { var templateEditor = { id: scope.node.templateId, - submit: function(model) { + submit: function (model) { editorService.close(); }, - close: function() { + close: function () { editorService.close(); } }; @@ -176,16 +176,16 @@ scope.node.template = templateAlias; }; - scope.openRollback = function() { - + scope.openRollback = function () { + var rollback = { node: scope.node, - submit: function(model) { + submit: function (model) { const args = { node: scope.node }; eventsService.emit("editors.content.reload", args); editorService.close(); }, - close: function() { + close: function () { editorService.close(); } };