wip publish descendants dialog
This commit is contained in:
@@ -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) {
|
||||
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,89 @@
|
||||
<div ng-controller="Umbraco.Overlays.PublishDescendantsController as vm">
|
||||
|
||||
|
||||
<div ng-if="vm.variants.length === 1">
|
||||
<div style="margin-bottom: 15px;">
|
||||
Click <em>Publish with descendants</em> to publish <strong>{{vm.variants[0].name}}</strong>
|
||||
and all content items underneath and thereby making their content publicly available.
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 15px;">
|
||||
<h5>Include drafts</h5>
|
||||
<label>
|
||||
<input
|
||||
id="{{variant.htmlId}}"
|
||||
name="publishVariantSelector"
|
||||
type="checkbox"
|
||||
ng-model="variant.publish"
|
||||
ng-change="vm.changeSelection(variant)"
|
||||
style="margin-right: 8px;"
|
||||
val-server-field="{{variant.htmlId}}" />
|
||||
Also publish unpublished content items
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div ng-if="vm.variants.length > 1">
|
||||
|
||||
<div style="margin-bottom: 15px;">
|
||||
Click <em>Publish with descendants</em> to publish <strong>the selected languages</strong>
|
||||
and the same languages of all content items underneath and thereby making their content publicly available.
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 15px;">
|
||||
<label>
|
||||
<input
|
||||
id="{{variant.htmlId}}"
|
||||
name="publishVariantSelector"
|
||||
type="checkbox"
|
||||
ng-model="variant.publish"
|
||||
ng-change="vm.changeSelection(variant)"
|
||||
style="margin-right: 8px;"
|
||||
val-server-field="{{variant.htmlId}}" />
|
||||
Include drafts: also publish unpublished Languages
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="bold" style="margin-bottom: 5px;">Languages</div>
|
||||
|
||||
<div class="umb-list umb-list--condensed">
|
||||
|
||||
<div class="umb-list-item umb-list--condensed" ng-repeat="variant in vm.variants">
|
||||
<ng-form name="publishVariantSelectorForm">
|
||||
<div class="flex">
|
||||
<input id="{{variant.htmlId}}"
|
||||
name="publishVariantSelector"
|
||||
type="checkbox"
|
||||
ng-model="variant.publish"
|
||||
ng-change="vm.changeSelection(variant)"
|
||||
style="margin-right: 8px;"
|
||||
val-server-field="{{variant.htmlId}}" />
|
||||
<div>
|
||||
<label for="{{variant.htmlId}}" style="margin-bottom: 0;">
|
||||
<span>{{ variant.language.name }}</span>
|
||||
</label>
|
||||
|
||||
<div class="umb-permission__description" ng-if="!publishVariantSelectorForm.publishVariantSelector.$invalid && !(variant.notifications && variant.notifications.length > 0)">
|
||||
<umb-variant-state variant="variant"></umb-variant-state>
|
||||
<span ng-if="variant.language.isMandatory"> - <localize key="languages_mandatoryLanguage"></localize></span>
|
||||
</div>
|
||||
|
||||
<div ng-messages="publishVariantSelectorForm.publishVariantSelector.$error" show-validation-on-submit>
|
||||
<div class="umb-permission__description" style="color: #F02E28;" ng-message="valServerField">{{publishVariantSelectorForm.publishVariantSelector.errorMsg}}</div>
|
||||
</div>
|
||||
|
||||
<div ng-repeat="notification in variant.notifications">
|
||||
<div class="umb-permission__description" style="color: #1FB572;">{{notification.message}}</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ng-form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user