Add interface logic for reverting page to previous version
This commit is contained in:
@@ -1,6 +1,14 @@
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<div class="title">Page Versions</div>
|
||||
<button
|
||||
*ngIf="selectedVersion && !selectedVersion.currentVersion"
|
||||
title="Revert to this version"
|
||||
class="revert"
|
||||
(click)="revertToVersion()"
|
||||
>
|
||||
Revert
|
||||
</button>
|
||||
<button title="Close" class="close" (click)="dismiss()">
|
||||
<i class="fa fa-times"></i>
|
||||
</button>
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
background: #ff6666;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.revert {
|
||||
color: red;
|
||||
background: #eaeaea;
|
||||
}
|
||||
}
|
||||
|
||||
.contents {
|
||||
|
||||
@@ -29,8 +29,30 @@ export class VersionModalComponent implements OnInit {
|
||||
this.onVersionClick(this.pageVersions[0]);
|
||||
}
|
||||
|
||||
dismiss() {
|
||||
this.modals.dismiss();
|
||||
dismiss(reload = false) {
|
||||
this.modals.dismiss(reload);
|
||||
}
|
||||
|
||||
async revertToVersion() {
|
||||
const alert = await this.alerts.create({
|
||||
header: 'Revert page?',
|
||||
message: `This will revert the current version of the page to version ${this.selectedVersion.versionNum}. Continue?`,
|
||||
buttons: [
|
||||
{
|
||||
text: 'Keep It',
|
||||
role: 'cancel',
|
||||
},
|
||||
{
|
||||
text: 'Revert It',
|
||||
handler: async () => {
|
||||
await this.editorService.revertPageToVersion(this.pageId, this.selectedVersion.versionNum);
|
||||
this.dismiss(true);
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
await alert.present();
|
||||
}
|
||||
|
||||
async onVersionClick(version: PageVersionRecord) {
|
||||
|
||||
Reference in New Issue
Block a user