add schedule publish to the publish combo button

This commit is contained in:
Mads Rasmussen
2018-10-03 14:51:20 +02:00
parent 1e501cc3c3
commit 739effba46
6 changed files with 24 additions and 19 deletions

View File

@@ -177,7 +177,8 @@
methods: {
saveAndPublish: $scope.saveAndPublish,
sendToPublish: $scope.sendToPublish,
unPublish: $scope.unPublish
unPublish: $scope.unPublish,
schedulePublish: $scope.schedule
}
});

View File

@@ -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

View File

@@ -28,14 +28,6 @@
<umb-editor-footer-content-right>
<umb-button
alias="schedule"
type="button"
button-style="info"
action="schedule(content)"
label="Schedule">
</umb-button>
<umb-button
ng-if="infiniteModel.infiniteMode"
action="close()"

View File

@@ -63,11 +63,8 @@
return;
}
console.log(date);
//The date being passed in here is the user's local date/time that they have selected
//we need to convert this date back to the server date on the model.
var serverTime = dateHelper.convertToServerStringTime(moment(date), Umbraco.Sys.ServerVariables.application.serverTimeOffset);
// update publish value
@@ -86,9 +83,6 @@
//The date being passed in here is the user's local date/time that they have selected
//we need to convert this date back to the server date on the model.
console.log(date);
var serverTime = dateHelper.convertToServerStringTime(moment(date), Umbraco.Sys.ServerVariables.application.serverTimeOffset);
// update publish value

View File

@@ -45,7 +45,7 @@
</umb-date-time-picker>
<a ng-if="variant.releaseDate" ng-click="vm.clearPublishDate(variant)" class="btn umb-button--xxs dropdown-toggle umb-button-group__toggle">
<a ng-if="variant.releaseDate" ng-click="vm.clearPublishDate(variant)" class="btn umb-button--xxs dropdown-toggle umb-button-group__toggle" style="margin-left: -2px;">
<span class="icon icon-wrong"></span>
</a>
</div>
@@ -67,7 +67,7 @@
</umb-date-time-picker>
<a ng-if="variant.removeDate" ng-click="vm.clearUnpublishDate(variant)" class="btn umb-button--xxs dropdown-toggle umb-button-group__toggle">
<a ng-if="variant.removeDate" ng-click="vm.clearUnpublishDate(variant)" class="btn umb-button--xxs dropdown-toggle umb-button-group__toggle" style="margin-left: -2px;">
<span class="icon icon-wrong"></span>
</a>
</div>