Clean up comment editing.
Build and Test App / Build-and-test-App (push) Successful in 35s
Details
Build and Test App / Build-and-test-App (push) Successful in 35s
Details
This commit is contained in:
parent
7720ad9741
commit
01aee58c4f
|
@ -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 hasComment = computed(() => model.value && (model.value.comment.trim().length > 0 || model.value.checklistItems.length > 0))
|
||||||
|
|
||||||
const previousCommentValue: Ref<string> = ref('')
|
const previousCommentValue: Ref<string> = ref('')
|
||||||
|
const previousCommentChecklistItems: Ref<string[]> = ref([])
|
||||||
const commentEditorDialog = useTemplateRef('commentEditorDialog')
|
const commentEditorDialog = useTemplateRef('commentEditorDialog')
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -104,12 +105,14 @@ function toggleBehaviorRating() {
|
||||||
function showCommentEditor() {
|
function showCommentEditor() {
|
||||||
if (!model.value) return
|
if (!model.value) return
|
||||||
previousCommentValue.value = model.value?.comment
|
previousCommentValue.value = model.value?.comment
|
||||||
|
previousCommentChecklistItems.value = [...model.value?.checklistItems]
|
||||||
commentEditorDialog.value?.showModal()
|
commentEditorDialog.value?.showModal()
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancelCommentEdit() {
|
function cancelCommentEdit() {
|
||||||
if (model.value) {
|
if (model.value) {
|
||||||
model.value.comment = previousCommentValue.value
|
model.value.comment = previousCommentValue.value
|
||||||
|
model.value.checklistItems = previousCommentChecklistItems.value
|
||||||
}
|
}
|
||||||
commentEditorDialog.value?.close()
|
commentEditorDialog.value?.close()
|
||||||
}
|
}
|
||||||
|
@ -182,7 +185,7 @@ function addEntry() {
|
||||||
<div v-for="options, category in COMMENT_CHECKLIST_ITEMS" :key="category">
|
<div v-for="options, category in COMMENT_CHECKLIST_ITEMS" :key="category">
|
||||||
<h3 v-text="category"></h3>
|
<h3 v-text="category"></h3>
|
||||||
<label v-for="opt in options" :key="opt">
|
<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>
|
<span v-text="opt"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue