2019-08-15 21:18:33 +02:00
|
|
|
import StandardWidget from "./standard_widget.js";
|
|
|
|
|
2019-07-21 11:32:38 +02:00
|
|
|
const TPL = `
|
2020-01-04 09:04:08 +01:00
|
|
|
<table class="note-info-table" style="table-layout: fixed; width: 100%;">
|
2019-07-21 11:32:38 +02:00
|
|
|
<tr>
|
2020-01-04 09:04:08 +01:00
|
|
|
<th nowrap>Note ID:</th>
|
|
|
|
<td nowrap colspan="3" class="note-info-note-id"></td>
|
2019-07-21 11:32:38 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-01-04 09:04:08 +01:00
|
|
|
<th nowrap>Created:</th>
|
|
|
|
<td nowrap colspan="3" style="overflow: hidden; text-overflow: ellipsis;" class="note-info-date-created"></td>
|
2019-07-21 11:32:38 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-01-04 09:04:08 +01:00
|
|
|
<th nowrap>Modified:</th>
|
|
|
|
<td nowrap colspan="3" style="overflow: hidden; text-overflow: ellipsis;" class="note-info-date-modified"></td>
|
2019-07-21 11:32:38 +02:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2019-09-01 09:16:08 +02:00
|
|
|
<th>Type:</th>
|
2019-07-21 11:32:38 +02:00
|
|
|
<td class="note-info-type"></td>
|
2019-09-01 09:16:08 +02:00
|
|
|
|
|
|
|
<th>MIME:</th>
|
2019-07-21 11:32:38 +02:00
|
|
|
<td class="note-info-mime"></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
`;
|
|
|
|
|
2019-08-15 21:18:33 +02:00
|
|
|
class NoteInfoWidget extends StandardWidget {
|
2019-08-17 10:45:20 +02:00
|
|
|
getWidgetTitle() { return "Note info"; }
|
2019-07-21 11:32:38 +02:00
|
|
|
|
2019-08-15 21:18:33 +02:00
|
|
|
async doRenderBody() {
|
|
|
|
this.$body.html(TPL);
|
2019-07-21 11:32:38 +02:00
|
|
|
|
2019-08-15 21:18:33 +02:00
|
|
|
const $noteId = this.$body.find(".note-info-note-id");
|
|
|
|
const $dateCreated = this.$body.find(".note-info-date-created");
|
|
|
|
const $dateModified = this.$body.find(".note-info-date-modified");
|
|
|
|
const $type = this.$body.find(".note-info-type");
|
|
|
|
const $mime = this.$body.find(".note-info-mime");
|
2019-07-21 11:32:38 +02:00
|
|
|
|
|
|
|
const note = this.ctx.note;
|
|
|
|
|
|
|
|
$noteId.text(note.noteId);
|
2020-01-04 09:04:08 +01:00
|
|
|
$dateCreated
|
|
|
|
.text(note.dateCreated)
|
|
|
|
.attr("title", note.dateCreated);
|
|
|
|
|
|
|
|
$dateModified
|
|
|
|
.text(note.dateModified)
|
|
|
|
.attr("title", note.dateCreated);
|
|
|
|
|
2019-07-21 11:32:38 +02:00
|
|
|
$type.text(note.type);
|
2020-01-04 09:04:08 +01:00
|
|
|
|
|
|
|
$mime
|
|
|
|
.text(note.mime)
|
|
|
|
.attr("title", note.mime);
|
2019-07-21 11:32:38 +02:00
|
|
|
}
|
2019-08-06 22:39:27 +02:00
|
|
|
|
2019-09-03 21:31:39 +02:00
|
|
|
eventReceived(name, data) {
|
|
|
|
if (name === 'syncData') {
|
|
|
|
if (data.find(sd => sd.entityName === 'notes' && sd.entityId === this.ctx.note.noteId)) {
|
|
|
|
this.doRenderBody();
|
|
|
|
}
|
2019-08-06 22:39:27 +02:00
|
|
|
}
|
|
|
|
}
|
2019-07-21 11:32:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default NoteInfoWidget;
|