Commit a4515778 authored by Fatih Acet's avatar Fatih Acet

IssueNotesRefactor: Fix ToDo list editability.

parent 77f6f0b8
......@@ -147,6 +147,7 @@ export default {
</div>
<issue-note-body
:note="note"
:canEdit="note.current_user.can_edit"
:isEditing="isEditing"
:formUpdateHandler="formUpdateHandler"
:formCancelHandler="formCancelHandler"
......
......@@ -2,6 +2,7 @@
import IssueNoteEditedText from './issue_note_edited_text.vue';
import IssueNoteAwardsList from './issue_note_awards_list.vue';
import IssueNoteForm from './issue_note_form.vue';
import TaskList from '../../task_list';
export default {
props: {
......@@ -9,6 +10,10 @@ export default {
type: Object,
required: true,
},
canEdit: {
type: Boolean,
required: true,
},
isEditing: {
type: Boolean,
required: false,
......@@ -32,6 +37,15 @@ export default {
renderGFM() {
$(this.$refs['note-body']).renderGFM();
},
initTaskList() {
if (this.canEdit) {
new TaskList({
dataType: 'note',
fieldName: 'note',
selector: '.notes'
});
}
},
handleFormUpdate() {
this.formUpdateHandler({
note: this.$refs.noteForm.note,
......@@ -40,12 +54,17 @@ export default {
},
mounted() {
this.renderGFM();
this.initTaskList();
},
updated() {
this.initTaskList();
},
};
</script>
<template>
<div
:class="{ 'js-task-list-container': canEdit }"
ref="note-body"
class="note-body">
<div
......@@ -57,6 +76,11 @@ export default {
:updateHandler="handleFormUpdate"
:cancelHandler="formCancelHandler"
:noteBody="note.note" />
<textarea
v-if="canEdit"
v-model="note.note"
:data-update-url="note.path"
class="hidden js-task-list-field"></textarea>
<issue-note-edited-text
v-if="note.last_edited_by"
:editedAt="note.last_edited_at"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment