From 0c4f5a6361c022a975a0e4ec9cb50eded33473cb Mon Sep 17 00:00:00 2001 From: Julian Leucker <leuckerj@gmail.com> Date: Sun, 13 Oct 2024 19:28:03 +0200 Subject: [PATCH] Emit dirty event if LessonSummary is dirty --- .../coursebook/documentation/LessonSummary.vue | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonSummary.vue b/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonSummary.vue index 3710a45f8..6693fa390 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonSummary.vue +++ b/aleksis/apps/alsijil/frontend/components/coursebook/documentation/LessonSummary.vue @@ -155,7 +155,7 @@ export default { documentationCacheUpdateMixin, documentationPartMixin, ], - emits: ["open"], + emits: ["open", "dirty"], data() { return { topic: null, @@ -244,9 +244,25 @@ export default { }[this.appendIcon] || "" ); }, + dirty() { + return !( + this.topic === this.documentation.topic && + this.homework === this.documentation.homework && + this.groupNote === this.documentation.groupNote + ); + }, }, mounted() { this.$on("save", this.handleAppendIconSuccess); + + this.topic = this.documentation.topic; + this.homework = this.documentation.homework; + this.groupNote = this.documentation.groupNote; + }, + watch: { + dirty(dirty) { + this.$emit("dirty", dirty); + }, }, }; </script> -- GitLab