I’ve noticed that no new version is created unless the title or content changes.
I want to create a new page version triggered by the click on a checkbox, but keep the complete content. I just want to set a version message.
On the UI, when saving the page, this is possible.
thanks for the feedback.
Such a workaround would be good, but honestly, I’m not sure how to get the latest content.
I tried the following for the REST but have not been successful with the “value”. I want to keep the content as it is. To add a “space” (or any other small sign) to the existing content would be ok.
## @param LabelPickerId:title=Unique ID|type=string|required=true|default=1|desc=If more than one label picker in page, change this to a unique name.
#set ( $labelPickerId = "lpid-" + $paramLabelPickerId )
<script type="text/javascript">
AJS.toInit(function ($){
//every label checkbox on the page
jQuery(".custom_label_to_add.$labelPickerId").click(function() {
var labelComment = jQuery(this).val();
jQuery.ajax({
url: contextPath + "/rest/api/content/$content.id",
contentType: 'application/json',
type: 'PUT',
data: JSON.stringify({
"version": {
"message": "version comment: " + labelComment,
"number": $content.version + 1
},
"title": "$content.title",
"type": "page",
"body": {
"storage": {
"value": "",
"representation": "storage"
}
}
}),
success: function(postresponse) {
console.log(postresponse);
}
});
});
});
</script>