From 739effba467fd0ee7ed3ee85a291f736c798302c Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 3 Oct 2018 14:51:20 +0200 Subject: [PATCH] add schedule publish to the publish combo button --- .../components/content/edit.controller.js | 3 ++- .../services/contenteditinghelper.service.js | 21 +++++++++++++++++-- .../src/views/components/content/edit.html | 8 ------- .../content/overlays/schedule.controller.js | 6 ------ .../src/views/content/overlays/schedule.html | 4 ++-- .../Umbraco/config/lang/en_us.xml | 1 + 6 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js index ef7702740a..73a62b2761 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js @@ -177,7 +177,8 @@ methods: { saveAndPublish: $scope.saveAndPublish, sendToPublish: $scope.sendToPublish, - unPublish: $scope.unPublish + unPublish: $scope.unPublish, + schedulePublish: $scope.schedule } }); 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 a11c93c2da..6efdb7ffdc 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 @@ -146,7 +146,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, notifica if (!args.methods) { throw "args.methods is not defined"; } - if (!args.methods.saveAndPublish || !args.methods.sendToPublish || !args.methods.unPublish) { + if (!args.methods.saveAndPublish || !args.methods.sendToPublish || !args.methods.unPublish || !args.methods.schedulePublish) { throw "args.methods does not contain all required defined methods"; } @@ -189,6 +189,16 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, notifica hotKeyWhenHidden: true, alias: "unpublish" }; + case "SCHEDULE": + //schedule publish - schedule doesn't have a permission letter so + // the button letter is made unique so it doesn't collide with anything else + return { + letter: ch, + labelKey: "buttons_schedulePublish", + handler: args.methods.schedulePublish, + alias: "schedulePublish", + addEllipsis: args.content.variants && args.content.variants.length > 1 ? "true" : "false" + }; default: return null; } @@ -199,7 +209,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, notifica //This is the ideal button order but depends on circumstance, we'll use this array to create the button list // Publish, SendToPublish - var buttonOrder = ["U", "H"]; + var buttonOrder = ["U", "H", "SCHEDULE"]; //Create the first button (primary button) //We cannot have the Save or SaveAndPublish buttons if they don't have create permissions when we are creating a new item. @@ -214,6 +224,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, notifica break; } } + //Here's the special check, if the button still isn't set and we are creating and they have create access //we need to add the Save button if (!buttons.defaultButton && args.create && _.contains(args.content.allowedActions, "C")) { @@ -236,6 +247,12 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, notifica } } + // if publishing is allowed also allow schedule publish + // we add this manually becuase it doesn't have a permission so it wont + // get picked up by the loop through permissions + if( _.contains(args.content.allowedActions, "U")) { + buttons.subButtons.push(createButtonDefinition("SCHEDULE")); + } // if we are not creating, then we should add unpublish too, // so long as it's already published and if the user has access to publish diff --git a/src/Umbraco.Web.UI.Client/src/views/components/content/edit.html b/src/Umbraco.Web.UI.Client/src/views/components/content/edit.html index 1fb9d6691c..d5ee000e87 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/content/edit.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/content/edit.html @@ -28,14 +28,6 @@ - - - - + @@ -67,7 +67,7 @@ - + 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 28d2f7700d..16b595b9f5 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -131,6 +131,7 @@ Save and schedule Send for approval Save list view + Schedule publish Preview Preview is disabled because there's no template assigned Choose style