Added the possibility to select all the cultures at once in the save and save&publish dialogs (#15776)
This commit is contained in:
@@ -6,8 +6,10 @@
|
||||
var vm = this;
|
||||
vm.loading = true;
|
||||
vm.isNew = true;
|
||||
vm.publishAll = false;
|
||||
|
||||
vm.changeSelection = changeSelection;
|
||||
vm.changePublishAllSelection = changePublishAllSelection;
|
||||
|
||||
function allowPublish (variant) {
|
||||
return variant.allowedActions.includes("U");
|
||||
@@ -38,6 +40,20 @@
|
||||
$scope.model.disableSubmitButton = !canPublish();
|
||||
//need to set the Save state to same as publish.
|
||||
variant.save = variant.publish;
|
||||
//update publishAll checkbox value
|
||||
updatePublishAllSelectionStatus();
|
||||
}
|
||||
|
||||
function changePublishAllSelection(){
|
||||
vm.availableVariants.forEach(variant => {
|
||||
variant.publish = vm.publishAll;
|
||||
variant.save = variant.publish;
|
||||
});
|
||||
$scope.model.disableSubmitButton = !canPublish();
|
||||
}
|
||||
|
||||
function updatePublishAllSelectionStatus(){
|
||||
vm.publishAll = vm.availableVariants.every(x => x.publish);
|
||||
}
|
||||
|
||||
function hasAnyDataFilter(variant) {
|
||||
@@ -138,7 +154,7 @@
|
||||
|
||||
vm.availableVariants = vm.variants.filter(publishableVariantFilter);
|
||||
vm.missingMandatoryVariants = vm.variants.filter(notPublishableButMandatoryFilter);
|
||||
|
||||
|
||||
// if any active varaiant that is available for publish, we set it to be published:
|
||||
vm.availableVariants.forEach(v => {
|
||||
if(v.active && allowPublish(v)) {
|
||||
@@ -152,6 +168,9 @@
|
||||
|
||||
$scope.model.disableSubmitButton = !canPublish();
|
||||
|
||||
//update publishAll checkbox value
|
||||
updatePublishAllSelectionStatus();
|
||||
|
||||
const localizeKey = vm.missingMandatoryVariants.length > 0 ? 'content_notReadyToPublish' :
|
||||
!$scope.model.title ? 'content_readyToPublish' : '';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div ng-if="vm.loading" style="min-height: 50px; position: relative;">
|
||||
<umb-load-indicator></umb-load-indicator>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="umb-list umb-list--condensed" ng-if="!vm.loading && vm.missingMandatoryVariants.length === 0">
|
||||
|
||||
<div class="mb3">
|
||||
@@ -12,6 +12,17 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="umb-list-item" ng-if="vm.availableVariants.length > 1">
|
||||
<umb-checkbox
|
||||
model="vm.publishAll"
|
||||
name="publishAllVariantsSelector"
|
||||
on-change="vm.changePublishAllSelection()"
|
||||
disabled="vm.availableVariants.length == 0">
|
||||
<span class="umb-variant-selector-entry__title">
|
||||
<localize key="content_selectAllVariants">Select all variants</localize>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="umb-list-item"
|
||||
ng-repeat="variant in vm.availableVariants track by variant.compositeId">
|
||||
<ng-form name="publishVariantSelectorForm">
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
|
||||
var vm = this;
|
||||
vm.includeUnpublished = $scope.model.includeUnpublished || false;
|
||||
vm.publishAll = false;
|
||||
|
||||
vm.changeSelection = changeSelection;
|
||||
vm.toggleIncludeUnpublished = toggleIncludeUnpublished;
|
||||
vm.changePublishAllSelection = changePublishAllSelection;
|
||||
|
||||
function onInit() {
|
||||
|
||||
@@ -48,8 +50,10 @@
|
||||
active.publish = active.save = true;
|
||||
}
|
||||
|
||||
$scope.model.disableSubmitButton = !canPublish();
|
||||
updatePublishAllSelectionStatus();
|
||||
|
||||
$scope.model.disableSubmitButton = !canPublish();
|
||||
|
||||
} else {
|
||||
// localize help text for invariant content
|
||||
vm.labels.help = {
|
||||
@@ -97,8 +101,20 @@
|
||||
$scope.model.disableSubmitButton = !canPublish();
|
||||
//need to set the Save state to true if publish is true
|
||||
variant.save = variant.publish;
|
||||
updatePublishAllSelectionStatus();
|
||||
}
|
||||
|
||||
function changePublishAllSelection(){
|
||||
vm.displayVariants.forEach(variant => {
|
||||
variant.publish = vm.publishAll;
|
||||
variant.save = variant.publish;
|
||||
});
|
||||
$scope.model.disableSubmitButton = !canPublish();
|
||||
}
|
||||
|
||||
function updatePublishAllSelectionStatus(){
|
||||
vm.publishAll = vm.displayVariants.every(x => x.publish);
|
||||
}
|
||||
|
||||
function isMandatoryFilter(variant) {
|
||||
//determine a variant is 'dirty' (meaning it will show up as publish-able) if it's
|
||||
|
||||
@@ -38,6 +38,17 @@
|
||||
|
||||
<div class="umb-list umb-list--condensed">
|
||||
|
||||
<div class="umb-list-item" ng-if="vm.displayVariants.length > 1">
|
||||
<umb-checkbox
|
||||
model="vm.publishAll"
|
||||
name="publishAllVariantsSelector"
|
||||
on-change="vm.changePublishAllSelection()"
|
||||
disabled="vm.displayVariants.length == 0">
|
||||
<span class="umb-variant-selector-entry__title">
|
||||
<localize key="content_selectAllVariants">Select all variants</localize>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="umb-list-item umb-list--condensed" ng-repeat="variant in vm.displayVariants track by variant.compositeId">
|
||||
<ng-form name="publishVariantSelectorForm">
|
||||
<div class="umb-variant-selector-entry" ng-class="{'umb-list-item--error': publishVariantSelectorForm.publishVariantSelector.$invalid}">
|
||||
|
||||
@@ -7,14 +7,28 @@
|
||||
vm.loading = true;
|
||||
vm.hasPristineVariants = false;
|
||||
vm.isNew = true;
|
||||
vm.saveAll = false;
|
||||
|
||||
vm.changeSelection = changeSelection;
|
||||
vm.changeSaveAllSelection = changeSaveAllSelection;
|
||||
|
||||
function changeSelection(variant) {
|
||||
var firstSelected = _.find(vm.variants, function (v) {
|
||||
return v.save;
|
||||
});
|
||||
$scope.model.disableSubmitButton = !firstSelected; //disable submit button if there is none selected
|
||||
updateSaveAllSelectionStatus();
|
||||
}
|
||||
|
||||
function changeSaveAllSelection(){
|
||||
vm.availableVariants.forEach(variant => {
|
||||
variant.save = vm.saveAll;
|
||||
});
|
||||
$scope.model.disableSubmitButton = !vm.saveAll;
|
||||
}
|
||||
|
||||
function updateSaveAllSelectionStatus(){
|
||||
vm.saveAll = vm.availableVariants.every(x => x.save);
|
||||
}
|
||||
|
||||
function allowUpdate (variant) {
|
||||
@@ -92,6 +106,8 @@
|
||||
|
||||
vm.availableVariants = contentEditingHelper.getSortedVariantsAndSegments(vm.availableVariants);
|
||||
|
||||
updateSaveAllSelectionStatus();
|
||||
|
||||
} else {
|
||||
//disable save button if we have nothing to save
|
||||
$scope.model.disableSubmitButton = true;
|
||||
|
||||
@@ -13,6 +13,17 @@
|
||||
|
||||
<div class="umb-list umb-list--condensed">
|
||||
|
||||
<div class="umb-list-item" ng-if="vm.availableVariants.length > 1">
|
||||
<umb-checkbox
|
||||
model="vm.saveAll"
|
||||
name="saveAllVariantsSelector"
|
||||
on-change="vm.changeSaveAllSelection()"
|
||||
disabled="vm.availableVariants.length == 0">
|
||||
<span class="umb-variant-selector-entry__title">
|
||||
<localize key="content_selectAllVariants">Select all variants</localize>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="umb-list-item"
|
||||
ng-repeat="variant in vm.availableVariants track by variant.compositeId">
|
||||
<ng-form name="saveVariantSelectorForm">
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
var vm = this;
|
||||
vm.loading = true;
|
||||
vm.selectedVariants = [];
|
||||
vm.sendToPublishAll = false;
|
||||
|
||||
vm.changeSelection = changeSelection;
|
||||
vm.changeSendToPublishAllSelection = changeSendToPublishAllSelection;
|
||||
|
||||
function onInit() {
|
||||
|
||||
@@ -29,8 +31,9 @@
|
||||
if (vm.availableVariants.length !== 0) {
|
||||
|
||||
vm.availableVariants = contentEditingHelper.getSortedVariantsAndSegments(vm.availableVariants);
|
||||
updateSendToPublishAllSelectionStatus();
|
||||
}
|
||||
|
||||
|
||||
$scope.model.disableSubmitButton = true;
|
||||
vm.loading = false;
|
||||
}
|
||||
@@ -55,10 +58,39 @@
|
||||
|
||||
let firstSelected = vm.variants.find(v => v.save);
|
||||
$scope.model.disableSubmitButton = !firstSelected;
|
||||
updateSendToPublishAllSelectionStatus();
|
||||
}
|
||||
|
||||
function changeSendToPublishAllSelection(){
|
||||
|
||||
vm.availableVariants.forEach(variant => {
|
||||
|
||||
variant.publish = vm.sendToPublishAll;
|
||||
let foundVariant = vm.selectedVariants.find(x => x.compositeId === variant.compositeId);
|
||||
|
||||
if (foundVariant === undefined) {
|
||||
variant.save = true;
|
||||
vm.selectedVariants.push(variant);
|
||||
} else {
|
||||
if(!vm.sendToPublishAll){
|
||||
variant.save = false;
|
||||
let index = vm.selectedVariants.indexOf(foundVariant);
|
||||
if (index !== -1) {
|
||||
vm.selectedVariants.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
let firstSelected = vm.variants.find(v => v.save);
|
||||
$scope.model.disableSubmitButton = !firstSelected;
|
||||
}
|
||||
|
||||
function updateSendToPublishAllSelectionStatus(){
|
||||
vm.sendToPublishAll = vm.availableVariants.every(x => x.publish);
|
||||
}
|
||||
|
||||
|
||||
function isMandatoryFilter(variant) {
|
||||
function isMandatoryFilter(variant) {
|
||||
//determine a variant is 'dirty' (meaning it will show up as publish-able) if it's
|
||||
// * has a mandatory language
|
||||
// * without having a segment, segments cant be mandatory at current state of code.
|
||||
|
||||
@@ -10,6 +10,17 @@
|
||||
|
||||
<div class="umb-list umb-list--condensed" ng-if="!vm.loading">
|
||||
|
||||
<div class="umb-list-item" ng-if="vm.availableVariants.length > 1">
|
||||
<umb-checkbox
|
||||
model="vm.sendToPublishAll"
|
||||
name="sendToPublishAllVariantsSelector"
|
||||
on-change="vm.changeSendToPublishAllSelection()"
|
||||
disabled="vm.availableVariants.length == 0">
|
||||
<span class="umb-variant-selector-entry__title">
|
||||
<localize key="content_selectAllVariants">Select all variants</localize>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="umb-list-item" ng-repeat="variant in vm.availableVariants track by variant.compositeId">
|
||||
<ng-form name="publishVariantSelectorForm">
|
||||
<div class="umb-variant-selector-entry" ng-class="{'umb-list-item--error': publishVariantSelectorForm.publishVariantSelector.$invalid}">
|
||||
|
||||
Reference in New Issue
Block a user