feat: show date on revision preview
This commit is contained in:
@@ -61,10 +61,11 @@ class HistoryMenuCtrl extends PureViewCtrl<unknown, HistoryState> {
|
||||
}
|
||||
}
|
||||
|
||||
async openSessionRevision(revision: HistoryEntry) {
|
||||
async openSessionRevision(revision: HistoryEntry & { previewTitle: () => string }) {
|
||||
this.application.presentRevisionPreviewModal(
|
||||
revision.payload.uuid,
|
||||
revision.payload.content
|
||||
revision.payload.content,
|
||||
revision.previewTitle()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -84,7 +85,8 @@ class HistoryMenuCtrl extends PureViewCtrl<unknown, HistoryState> {
|
||||
}
|
||||
this.application.presentRevisionPreviewModal(
|
||||
remoteRevision.payload.uuid,
|
||||
remoteRevision.payload.content
|
||||
remoteRevision.payload.content,
|
||||
this.previewRemoteHistoryTitle(revision)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -154,7 +156,7 @@ class HistoryMenuCtrl extends PureViewCtrl<unknown, HistoryState> {
|
||||
this.reloadState();
|
||||
}
|
||||
|
||||
previewRemoteHistoryTitle(revision: SingleRevision) {
|
||||
previewRemoteHistoryTitle(revision: RevisionListEntry) {
|
||||
return new Date(revision.created_at).toLocaleString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ class RevisionPreviewModalCtrl extends PureViewCtrl implements RevisionPreviewSc
|
||||
$timeout: ng.ITimeoutService
|
||||
uuid!: string
|
||||
content!: PayloadContent
|
||||
title?: string
|
||||
application!: WebApplication
|
||||
unregisterComponent?: any
|
||||
note!: SNNote
|
||||
@@ -139,6 +140,7 @@ export class RevisionPreviewModal extends WebDirective {
|
||||
this.scope = {
|
||||
uuid: '=',
|
||||
content: '=',
|
||||
title: '=',
|
||||
application: '='
|
||||
};
|
||||
}
|
||||
|
||||
@@ -189,13 +189,14 @@ export class WebApplication extends SNApplication {
|
||||
this.applicationElement.append(el);
|
||||
}
|
||||
|
||||
presentRevisionPreviewModal(uuid: string, content: any) {
|
||||
presentRevisionPreviewModal(uuid: string, content: any, title?: string) {
|
||||
const scope: any = this.scope!.$new(true);
|
||||
scope.uuid = uuid;
|
||||
scope.content = content;
|
||||
scope.title = title;
|
||||
scope.application = this;
|
||||
const el = this.$compile!(
|
||||
`<revision-preview-modal application='application' uuid='uuid' content='content'
|
||||
`<revision-preview-modal application='application' uuid='uuid' content='content' title='title'
|
||||
class='sk-modal'></revision-preview-modal>`
|
||||
)(scope);
|
||||
this.applicationElement.append(el);
|
||||
|
||||
@@ -5,7 +5,11 @@
|
||||
.sn-component
|
||||
.sk-panel
|
||||
.sk-panel-header
|
||||
.sk-panel-header-title Preview
|
||||
div
|
||||
.sk-panel-header-title Preview
|
||||
.sk-subtitle.neutral.mt-1(
|
||||
ng-if="ctrl.title"
|
||||
) {{ctrl.title}}
|
||||
.sk-horizontal-group
|
||||
a.sk-a.info.close-button(
|
||||
ng-click="ctrl.restore(false)"
|
||||
|
||||
Reference in New Issue
Block a user