Clean up comment editing.
Build and Test App / Build-and-test-App (push) Successful in 35s Details

This commit is contained in:
Andrew Lalis 2025-09-01 16:34:39 -04:00
parent 7720ad9741
commit 01aee58c4f
1 changed files with 4 additions and 1 deletions

View File

@ -37,6 +37,7 @@ const entryChanged = computed(() => JSON.stringify(model.value) !== initialEntry
const hasComment = computed(() => model.value && (model.value.comment.trim().length > 0 || model.value.checklistItems.length > 0))
const previousCommentValue: Ref<string> = ref('')
const previousCommentChecklistItems: Ref<string[]> = ref([])
const commentEditorDialog = useTemplateRef('commentEditorDialog')
onMounted(() => {
@ -104,12 +105,14 @@ function toggleBehaviorRating() {
function showCommentEditor() {
if (!model.value) return
previousCommentValue.value = model.value?.comment
previousCommentChecklistItems.value = [...model.value?.checklistItems]
commentEditorDialog.value?.showModal()
}
function cancelCommentEdit() {
if (model.value) {
model.value.comment = previousCommentValue.value
model.value.checklistItems = previousCommentChecklistItems.value
}
commentEditorDialog.value?.close()
}
@ -182,7 +185,7 @@ function addEntry() {
<div v-for="options, category in COMMENT_CHECKLIST_ITEMS" :key="category">
<h3 v-text="category"></h3>
<label v-for="opt in options" :key="opt">
<input type="checkbox" v-model="model.checklistItems" :value="opt" />
<input type="checkbox" v-model="model.checklistItems" :value="opt" :disabled="disabled" />
<span v-text="opt"></span>
</label>
</div>