mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 02:52:27 +08:00
feat(time_selector): avoid "template concatenation"
This commit is contained in:
parent
fc8f805b28
commit
d26d668741
@ -9,9 +9,7 @@ const TPL = `
|
||||
<h4>${t("attachment_erasure_timeout.attachment_erasure_timeout")}</h4>
|
||||
|
||||
<p>${t("attachment_erasure_timeout.attachment_auto_deletion_description")}</p>
|
||||
`;
|
||||
|
||||
const TPL2 = `
|
||||
<div id="time-selector-placeholder"></div>
|
||||
<p>${t("attachment_erasure_timeout.manual_erasing_description")}</p>
|
||||
|
||||
<button class="erase-unused-attachments-now-button btn btn-secondary">${t("attachment_erasure_timeout.erase_unused_attachments_now")}</button>
|
||||
@ -31,7 +29,10 @@ export default class AttachmentErasureTimeoutOptions extends TimeSelector {
|
||||
}
|
||||
|
||||
doRender() {
|
||||
this.$widget = $(TPL).append(this.$widget).append(TPL2);
|
||||
const $timeSelector = this.$widget;
|
||||
this.$widget = $(TPL);
|
||||
// inject TimeSelector widget template
|
||||
this.$widget.find("#time-selector-placeholder").replaceWith($timeSelector);
|
||||
|
||||
this.$eraseUnusedAttachmentsNowButton = this.$widget.find(".erase-unused-attachments-now-button");
|
||||
this.$eraseUnusedAttachmentsNowButton.on("click", () => {
|
||||
|
@ -9,9 +9,7 @@ const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>${t("note_erasure_timeout.note_erasure_timeout_title")}</h4>
|
||||
<p>${t("note_erasure_timeout.note_erasure_description")}</p>
|
||||
`;
|
||||
|
||||
const TPL2 = `
|
||||
<div id="time-selector-placeholder"></div>
|
||||
<p>${t("note_erasure_timeout.manual_erasing_description")}</p>
|
||||
<button id="erase-deleted-notes-now-button" class="btn btn-secondary">${t("note_erasure_timeout.erase_deleted_notes_now")}</button>
|
||||
</div>`;
|
||||
@ -30,7 +28,10 @@ export default class NoteErasureTimeoutOptions extends TimeSelector {
|
||||
}
|
||||
|
||||
doRender() {
|
||||
this.$widget = $(TPL).append(this.$widget).append(TPL2);
|
||||
const $timeSelector = this.$widget;
|
||||
// inject TimeSelector widget template
|
||||
this.$widget = $(TPL);
|
||||
this.$widget.find("#time-selector-placeholder").replaceWith($timeSelector)
|
||||
|
||||
this.$eraseDeletedNotesButton = this.$widget.find("#erase-deleted-notes-now-button");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user