From fc766724c4a211292b1d5185737896fe96976992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sat, 18 Mar 2023 18:00:54 +0800 Subject: [PATCH] Removed the redundant "summary" parameter from the "#onOpen" and static "start" methods of JavaScript SummaryEditor. --- src/accounting/static/js/journal-entry-editor.js | 2 +- src/accounting/static/js/summary-editor.js | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/accounting/static/js/journal-entry-editor.js b/src/accounting/static/js/journal-entry-editor.js index 11df882..38d2661 100644 --- a/src/accounting/static/js/journal-entry-editor.js +++ b/src/accounting/static/js/journal-entry-editor.js @@ -220,7 +220,7 @@ class JournalEntryEditor { this.#amountError = document.getElementById(this.#prefix + "-amount-error"); this.#originalEntryControl.onclick = () => OriginalEntrySelector.start(this, this.originalEntryId); this.#originalEntryDelete.onclick = () => this.clearOriginalEntry(); - this.#summaryControl.onclick = () => SummaryEditor.start(this, this.summary); + this.#summaryControl.onclick = () => SummaryEditor.start(this); this.#accountControl.onclick = () => AccountSelector.start(this, this.entryType); this.#amount.onchange = () => this.#validateAmount(); this.#element.onsubmit = () => { diff --git a/src/accounting/static/js/summary-editor.js b/src/accounting/static/js/summary-editor.js index a538bfe..97e20d8 100644 --- a/src/accounting/static/js/summary-editor.js +++ b/src/accounting/static/js/summary-editor.js @@ -228,12 +228,11 @@ class SummaryEditor { * The callback when the summary editor is shown. * * @param entryEditor {JournalEntryEditor} the journal entry editor - * @param summary {string|null} the summary */ - #onOpen(entryEditor, summary) { + #onOpen(entryEditor) { this.#entryEditor = entryEditor; this.#reset(); - this.summary.value = summary === null? "": summary; + this.summary.value = entryEditor.summary === null? "": entryEditor.summary; this.#onSummaryChange(); } @@ -271,10 +270,9 @@ class SummaryEditor { * The callback when the summary editor is shown. * * @param entryEditor {JournalEntryEditor} the journal entry editor - * @param summary {string|null} the summary */ - static start(entryEditor, summary) { - this.#editors[entryEditor.entryType].#onOpen(entryEditor, summary); + static start(entryEditor) { + this.#editors[entryEditor.entryType].#onOpen(entryEditor); } }