From 1b19258ae0b552503bed9b8b7b599c315a80e35b Mon Sep 17 00:00:00 2001 From: Michael Bauer <michael-bauer@posteo.de> Date: Wed, 31 Jan 2024 19:16:56 +0100 Subject: [PATCH] Implement lesson summary (topic, homework, note) interface Initial version for desktop & edit. Will update for mobile. --- .../documentation/LessonSummary.vue | 56 +++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/aleksis/apps/alsijil/frontend/components/documentation/LessonSummary.vue b/aleksis/apps/alsijil/frontend/components/documentation/LessonSummary.vue index 10940a549..c4d5a905f 100644 --- a/aleksis/apps/alsijil/frontend/components/documentation/LessonSummary.vue +++ b/aleksis/apps/alsijil/frontend/components/documentation/LessonSummary.vue @@ -1,9 +1,38 @@ <template> <v-card-text> - <div>Lesson Summary Component</div> - <div>{{ documentation.topic }}</div> - <div>{{ documentation.homework }}</div> - <div>{{ documentation.groupnote }}</div> + <!-- Are focusout & enter enough trigger? --> + <!-- TODO: focusout on enter --> + <v-text-field + label="Thema" + :value="documentation.topic" + @input="topic=$event" + @focusout="saveTopic" + @keydown.enter="saveTopic" + /> + <v-text-field + v-if="!compact" + label="Hausaufgaben" + :value="documentation.homework" + @input="homework=$event" + /> + <v-text-field + v-if="!compact" + label="Gruppennotiz" + :value="documentation.groupnote" + @input="groupnote=$event" + /> + <v-chip + v-if="compact" + outlined + > + Hausaufgaben: {{ truncate(documentation.homework) }} + </v-chip> + <v-chip + v-if="compact" + outlined + > + Gruppennotiz: {{ truncate(documentation.groupnote) }} + </v-chip> </v-card-text> </template> @@ -15,6 +44,25 @@ export default { type: Object, required: true, }, + compact: { + type: Boolean, + required: false, + default: true, + }, + }, + data() { + return { + topic: "", + }; + }, + methods: { + saveTopic() { + }, + truncate(str) { + return str ? + (str.length > 30) ? str.slice(0, 29) + '…' : str + : ""; + }, }, }; </script> -- GitLab