From 8fdbfea23ffcfa707a3529dddb000f5e286222ab Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 10 Oct 2018 11:33:42 +0200 Subject: [PATCH] wip publish descendants dialog --- .../components/content/edit.controller.js | 26 +++++- .../services/contenteditinghelper.service.js | 15 +++- .../overlays/publishdescendants.controller.js | 26 ++++++ .../content/overlays/publishdescendants.html | 89 +++++++++++++++++++ .../Umbraco/config/lang/en_us.xml | 1 + 5 files changed, 154 insertions(+), 3 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.controller.js create mode 100644 src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.html 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 efb63fe1ac..98e02f3d55 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 @@ -170,7 +170,8 @@ saveAndPublish: $scope.saveAndPublish, sendToPublish: $scope.sendToPublish, unpublish: $scope.unpublish, - schedulePublish: $scope.schedule + schedulePublish: $scope.schedule, + publishDescendants: $scope.publishDescendants } }); @@ -628,6 +629,29 @@ } }; + $scope.publishDescendants = function() { + clearNotifications($scope.content); + //before we launch the dialog we want to execute all client side validations first + if (formHelper.submitForm({ scope: $scope, action: "publishDescendants" })) { + var dialog = { + parentScope: $scope, + view: "views/content/overlays/publishdescendants.html", + variants: $scope.content.variants, //set a model property for the dialog + skipFormValidation: true, //when submitting the overlay form, skip any client side validation + submitButtonLabelKey: "buttons_publishDescendants", + submit: function (model) { + model.submitButtonState = "busy"; + clearNotifications($scope.content); + model.submitButtonState = "success"; + }, + close: function () { + overlayService.close(); + } + }; + overlayService.open(dialog); + } + }; + $scope.preview = function (content) { 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 777b336447..a75e8d4a47 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 || !args.methods.schedulePublish) { + if (!args.methods.saveAndPublish || !args.methods.sendToPublish || !args.methods.unpublish || !args.methods.schedulePublish || !args.methods.publishDescendants) { throw "args.methods does not contain all required defined methods"; } @@ -200,6 +200,16 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, notifica alias: "schedulePublish", addEllipsis: "true" }; + case "PUBLISH_DESCENDANTS": + // Publish descendants - it 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_publishDescendants", + handler: args.methods.publishDescendants, + alias: "publishDescendant", + addEllipsis: "true" + }; default: return null; } @@ -210,7 +220,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", "SCHEDULE"]; + var buttonOrder = ["U", "H", "SCHEDULE", "PUBLISH_DESCENDANTS"]; //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. @@ -253,6 +263,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, notifica // get picked up by the loop through permissions if( _.contains(args.content.allowedActions, "U")) { buttons.subButtons.push(createButtonDefinition("SCHEDULE")); + buttons.subButtons.push(createButtonDefinition("PUBLISH_DESCENDANTS")); } // if we are not creating, then we should add unpublish too, diff --git a/src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.controller.js new file mode 100644 index 0000000000..b6fcb8391f --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.controller.js @@ -0,0 +1,26 @@ +(function () { + "use strict"; + + function PublishDescendantsController($scope, localizationService) { + + var vm = this; + + function onInit() { + + vm.variants = $scope.model.variants; + + if (!$scope.model.title) { + localizationService.localize("buttons_publishDescendants").then(function (value) { + $scope.model.title = value; + }); + } + + } + + onInit(); + + } + + angular.module("umbraco").controller("Umbraco.Overlays.PublishDescendantsController", PublishDescendantsController); + +})(); diff --git a/src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.html b/src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.html new file mode 100644 index 0000000000..a5b035c82c --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.html @@ -0,0 +1,89 @@ +
+ + +
+
+ Click Publish with descendants to publish {{vm.variants[0].name}} + and all content items underneath and thereby making their content publicly available. +
+ +
+
Include drafts
+ +
+ +
+ +
+ +
+ Click Publish with descendants to publish the selected languages + and the same languages of all content items underneath and thereby making their content publicly available. +
+ +
+ +
+ +
Languages
+ +
+ +
+ +
+ +
+ + +
+ + - +
+ +
+
{{publishVariantSelectorForm.publishVariantSelector.errorMsg}}
+
+ +
+
{{notification.message}}
+
+ +
+
+ +
+
+
+ +
+ +
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 ae75d7af43..f78e25821d 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -118,6 +118,7 @@ Insert macro Insert picture Publish and close + Publish with descendants Edit relations Return to list Save