From 9ad69c11cbc46b6557a6c9b5a63603cc3dcfda3b Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Mon, 3 Dec 2018 18:45:50 +0100 Subject: [PATCH] Fix publish dates issues (#3507) --- .../services/contenteditinghelper.service.js | 4 ++-- src/Umbraco.Web.UI/umbraco/config/lang/da.xml | 2 ++ src/Umbraco.Web.UI/umbraco/config/lang/en.xml | 2 ++ .../umbraco/config/lang/en_us.xml | 2 ++ src/Umbraco.Web/Editors/ContentController.cs | 20 +++++++++++++------ 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js index ab84dc030f..5f0a76aa93 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js @@ -253,9 +253,9 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, notifica } } - // If we have a scheduled publish or unpublish date change the default button to + // If we have a scheduled publish date change the default button to // "save" and update the label to "save and schedule - if(args.content.releaseDate || args.content.removeDate) { + if(args.content.releaseDate) { // if save button is alread the default don't change it just update the label if (buttons.defaultButton && buttons.defaultButton.letter === "A") { diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml index 010b0a4a74..01e4a2a031 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml @@ -1079,8 +1079,10 @@ Mange hilsner fra Umbraco robotten Ordbogsnøgle gemt Indhold publiceret og nu synligt for besøgende + og nu synligt for besøgende indtil {0} Indhold gemt Husk at publicere for at gøre det synligt for besøgende + Ændringerne bliver publiceret den {0} Send til Godkendelse Rettelser er blevet sendt til godkendelse Medie gemt diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index dee70fd453..e22943fd40 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -1397,8 +1397,10 @@ To manage your website, simply open the Umbraco back office and start adding con Publishing failed because the parent page isn't published Content published and visible on the website + and visible on the website until {0} Content saved Remember to publish to make changes visible + Changes will be published on {0} Sent For Approval Changes have been sent for approval Media saved diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml index 3b5eb81da9..2fd9e6a772 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml @@ -1396,8 +1396,10 @@ To manage your website, simply open the Umbraco back office and start adding con Publishing failed because the parent page isn't published Content published and visible on the website + and visible on the website until {0} Content saved Remember to publish to make changes visible + Changes will be published on {0} Sent For Approval Changes have been sent for approval Media saved diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index 4643cb2a1e..89bd8016d3 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -696,7 +696,11 @@ namespace Umbraco.Web.Editors { display.AddSuccessNotification( Services.TextService.Localize("speechBubbles/editContentSavedHeader"), - Services.TextService.Localize("speechBubbles/editContentSavedText")); + contentItem.ReleaseDate.HasValue + ? string.Format(Services.TextService.Localize("speechBubbles/editContentSavedWithReleaseDateText"), + $"{contentItem.ReleaseDate.Value.ToLongDateString()} {contentItem.ReleaseDate.Value.ToString("HH:mm")}") + : Services.TextService.Localize("speechBubbles/editContentSavedText") + ); } else { @@ -718,7 +722,7 @@ namespace Umbraco.Web.Editors break; case ContentSaveAction.Publish: case ContentSaveAction.PublishNew: - ShowMessageForPublishStatus(publishStatus.Result, display); + ShowMessageForPublishStatus(publishStatus.Result, display, contentItem.ExpireDate); break; } @@ -759,7 +763,7 @@ namespace Umbraco.Web.Editors if (publishResult.Success == false) { var notificationModel = new SimpleNotificationModel(); - ShowMessageForPublishStatus(publishResult.Result, notificationModel); + ShowMessageForPublishStatus(publishResult.Result, notificationModel, foundContent.ExpireDate); return Request.CreateValidationErrorResponse(notificationModel); } @@ -1040,15 +1044,19 @@ namespace Umbraco.Web.Editors return toMove; } - private void ShowMessageForPublishStatus(PublishStatus status, INotificationModel display) + private void ShowMessageForPublishStatus(PublishStatus status, INotificationModel display, DateTime? expireDate) { switch (status.StatusType) { case PublishStatusType.Success: - case PublishStatusType.SuccessAlreadyPublished: + case PublishStatusType.SuccessAlreadyPublished: display.AddSuccessNotification( Services.TextService.Localize("speechBubbles/editContentPublishedHeader"), - Services.TextService.Localize("speechBubbles/editContentPublishedText")); + expireDate.HasValue + ? string.Format(Services.TextService.Localize("speechBubbles/editContentPublishedWithExpireDateText"), + $"{expireDate.Value.ToLongDateString()} {expireDate.Value.ToString("HH:mm")}") + : Services.TextService.Localize("speechBubbles/editContentPublishedText") + ); break; case PublishStatusType.FailedPathNotPublished: display.AddWarningNotification(