summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/diff_notes/components/comment_resolve_btn.js.es6
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/diff_notes/components/comment_resolve_btn.js.es6')
-rw-r--r--app/assets/javascripts/diff_notes/components/comment_resolve_btn.js.es659
1 files changed, 0 insertions, 59 deletions
diff --git a/app/assets/javascripts/diff_notes/components/comment_resolve_btn.js.es6 b/app/assets/javascripts/diff_notes/components/comment_resolve_btn.js.es6
deleted file mode 100644
index 2514459e65e..00000000000
--- a/app/assets/javascripts/diff_notes/components/comment_resolve_btn.js.es6
+++ /dev/null
@@ -1,59 +0,0 @@
-/* eslint-disable comma-dangle, object-shorthand, func-names, no-else-return, quotes, no-lonely-if, max-len */
-/* global Vue */
-/* global CommentsStore */
-
-(() => {
- const CommentAndResolveBtn = Vue.extend({
- props: {
- discussionId: String,
- },
- data() {
- return {
- textareaIsEmpty: true
- };
- },
- computed: {
- discussion: function () {
- return CommentsStore.state[this.discussionId];
- },
- showButton: function () {
- if (this.discussion) {
- return this.discussion.isResolvable();
- } else {
- return false;
- }
- },
- isDiscussionResolved: function () {
- return this.discussion.isResolved();
- },
- buttonText: function () {
- if (this.isDiscussionResolved) {
- if (this.textareaIsEmpty) {
- return "Unresolve discussion";
- } else {
- return "Comment & unresolve discussion";
- }
- } else {
- if (this.textareaIsEmpty) {
- return "Resolve discussion";
- } else {
- return "Comment & resolve discussion";
- }
- }
- }
- },
- mounted: function () {
- const $textarea = $(`#new-discussion-note-form-${this.discussionId} .note-textarea`);
- this.textareaIsEmpty = $textarea.val() === '';
-
- $textarea.on('input.comment-and-resolve-btn', () => {
- this.textareaIsEmpty = $textarea.val() === '';
- });
- },
- destroyed: function () {
- $(`#new-discussion-note-form-${this.discussionId} .note-textarea`).off('input.comment-and-resolve-btn');
- }
- });
-
- Vue.component('comment-and-resolve-btn', CommentAndResolveBtn);
-})(window);