Commit 905ad9cd authored by Fatih Acet's avatar Fatih Acet

IssueNotesRefactor: Implement show/hide of discussion reply form.

parent b3704daf
...@@ -4,6 +4,7 @@ import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_ ...@@ -4,6 +4,7 @@ import UserAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_
import IssueNoteHeader from './issue_note_header.vue'; import IssueNoteHeader from './issue_note_header.vue';
import IssueNoteActions from './issue_note_actions.vue'; import IssueNoteActions from './issue_note_actions.vue';
import IssueNoteEditedText from './issue_note_edited_text.vue'; import IssueNoteEditedText from './issue_note_edited_text.vue';
import IssueNoteForm from './issue_note_form.vue';
export default { export default {
props: { props: {
...@@ -16,6 +17,7 @@ export default { ...@@ -16,6 +17,7 @@ export default {
return { return {
registerLink: '#', registerLink: '#',
signInLink: '#', signInLink: '#',
isReplying: false,
}; };
}, },
computed: { computed: {
...@@ -32,6 +34,7 @@ export default { ...@@ -32,6 +34,7 @@ export default {
IssueNoteHeader, IssueNoteHeader,
IssueNoteActions, IssueNoteActions,
IssueNoteEditedText, IssueNoteEditedText,
IssueNoteForm,
}, },
mounted() { mounted() {
// We need to grab the register and sign in links from DOM for the time being. // We need to grab the register and sign in links from DOM for the time being.
...@@ -49,6 +52,15 @@ export default { ...@@ -49,6 +52,15 @@ export default {
discussionId: this.note.id, discussionId: this.note.id,
}); });
}, },
showReplyForm() {
this.isReplying = true;
},
cancelReplyForm() {
this.isReplying = false;
},
saveReply() {
this.isReplying = false;
},
}, },
}; };
</script> </script>
...@@ -95,10 +107,16 @@ export default { ...@@ -95,10 +107,16 @@ export default {
<div class="flash-container"></div> <div class="flash-container"></div>
<div class="discussion-reply-holder"> <div class="discussion-reply-holder">
<button <button
v-if="note.can_reply" v-if="note.can_reply && !isReplying"
@click="showReplyForm"
type="button" type="button"
class="btn btn-text-field js-discussion-reply-button" class="btn btn-text-field"
title="Add a reply">Reply...</button> title="Add a reply">Reply...</button>
<issue-note-form
v-if="isReplying"
saveButtonTitle="Comment"
:updateHandler="saveReply"
:cancelHandler="cancelReplyForm" />
<div <div
v-if="!note.can_reply" v-if="!note.can_reply"
class="disabled-comment text-center"> class="disabled-comment text-center">
......
...@@ -5,7 +5,8 @@ export default { ...@@ -5,7 +5,8 @@ export default {
props: { props: {
noteBody: { noteBody: {
type: String, type: String,
required: true, required: false,
default: '',
}, },
updateHandler: { updateHandler: {
type: Function, type: Function,
...@@ -15,6 +16,11 @@ export default { ...@@ -15,6 +16,11 @@ export default {
type: Function, type: Function,
required: true, required: true,
}, },
saveButtonTitle: {
type: String,
required: false,
default: 'Save comment',
}
}, },
data() { data() {
return { return {
...@@ -40,6 +46,7 @@ export default { ...@@ -40,6 +46,7 @@ export default {
this.markdownDocsUrl = markdownDocs; this.markdownDocsUrl = markdownDocs;
this.markdownPreviewUrl = markdownPreviewUrl; this.markdownPreviewUrl = markdownPreviewUrl;
this.$refs.textarea.focus();
}, },
}; };
</script> </script>
...@@ -68,7 +75,7 @@ export default { ...@@ -68,7 +75,7 @@ export default {
@click="handleUpdate" @click="handleUpdate"
type="button" type="button"
class="btn btn-nr btn-save"> class="btn btn-nr btn-save">
Save comment {{saveButtonTitle}}
</button> </button>
<button <button
@click="cancelHandler" @click="cancelHandler"
......
...@@ -250,6 +250,10 @@ ul.related-merge-requests > li { ...@@ -250,6 +250,10 @@ ul.related-merge-requests > li {
} }
} }
.discussion-reply-holder .note-edit-form {
display: block;
}
@media (min-width: $screen-sm-min) { @media (min-width: $screen-sm-min) {
.emoji-block .row { .emoji-block .row {
display: flex; display: flex;
......
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