no matter what you can always publish the current variant

This commit is contained in:
Shannon
2018-05-09 14:34:55 +10:00
parent 9c1451ecd3
commit d90ccbb7f0
4 changed files with 7 additions and 27 deletions

View File

@@ -318,18 +318,7 @@
// TODO: Add "..." to publish button label if there are more than one variant to publish - currently it just adds the elipses if there's more than 1 variant
if ($scope.content.variants.length > 1) {
//before we launch the dialog we want to execute all client side validations first
if (formHelper.submitForm({ scope: $scope, action: "publish", formCtrl: $scope.contentForm })) {
//we need to check if the current form is dirty and if so we need to update the current variant's isEdited property to true
//so that the publish dialog knows that it's a dirty culture and that it should be allowed to be published
if ($scope.contentForm.$dirty) {
_.each($scope.content.variants, function (d) {
//set the isEdited flag if it's the current one
if (d.current === true) {
d.isEdited = true;
}
});
}
if (formHelper.submitForm({ scope: $scope, action: "publish"})) {
var dialog = {
title: localizationService.localize("content_readyToPublish"),

View File

@@ -9,7 +9,6 @@
vm.loading = true;
vm.dirtyVariantFilter = dirtyVariantFilter;
vm.pristineVariantFilter = pristineVariantFilter;
vm.hasDirtyVariants = false;
vm.hasPristineVariants = false;
//watch this model, if it's reset, then re init
@@ -40,15 +39,14 @@
}
function dirtyVariantFilter(variant) {
return (variant.isEdited === true || (variant.isEdited === false && variant.state === "Unpublished"));
return (variant.current || variant.isEdited === true || (variant.isEdited === false && variant.state === "Unpublished"));
}
function pristineVariantFilter(variant) {
return !(variant.isEdited === true || (variant.isEdited === false && variant.state === "Unpublished"));
return !(dirtyVariantFilter(variant));
}
function onInit() {
vm.hasDirtyVariants = false;
vm.hasPristineVariants = false;
_.each(vm.variants,
@@ -56,13 +54,8 @@
variant.compositeId = variant.language.id + "_" + (variant.segment ? variant.segment : "");
variant.htmlId = "publish_variant_" + variant.compositeId;
//check for dirty variants
if (variant.isEdited === true || (variant.isEdited === false && variant.state === "Unpublished")) {
vm.hasDirtyVariants = true;
}
else {
vm.hasPristineVariants = true;
}
//check for pristine variants
vm.hasPristineVariants = !(dirtyVariantFilter(variant));
});
if (vm.variants.length !== 0) {

View File

@@ -1,15 +1,14 @@
<div ng-controller="Umbraco.Overlays.PublishController as vm">
<div style="margin-bottom: 15px;">
<p ng-if="vm.hasDirtyVariants"><localize key="content_languagesToPublish"></localize></p>
<p ng-if="!vm.hasDirtyVariants"><localize key="content_noLanguagesToPublish"></localize></p>
<p><localize key="content_languagesToPublish"></localize></p>
</div>
<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.hasDirtyVariants">
<div class="umb-list umb-list--condensed" ng-if="!vm.loading">
<div class="umb-list-item" ng-repeat="variant in vm.variants | filter:vm.dirtyVariantFilter">
<ng-form name="publishVariantSelectorForm">

View File

@@ -233,7 +233,6 @@
<key alias="isSensitiveValue">This value is hidden. If you need access to view this value please contact your website administrator.</key>
<key alias="isSensitiveValue_short">This value is hidden.</key>
<key alias="languagesToPublish">What languages would you like to publish?</key>
<key alias="noLanguagesToPublish">No languages available to be published.</key>
<key alias="publishedLanguages">Published Languages.</key>
<key alias="readyToPublish">Ready to Publish?</key>
</area>