diff options
author | Phil Hughes <me@iamphill.com> | 2016-11-07 10:05:58 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-11-10 17:53:34 +0300 |
commit | 4fba69dc90d9c423f491f58b62a9d814d07d7ef2 (patch) | |
tree | f722db9223968cefa1179e3ea27e97c9943f4d58 /app/assets | |
parent | 1505fc3ac5a596966773abd886fb98c096322803 (diff) | |
download | gitlab-ce-4fba69dc90d9c423f491f58b62a9d814d07d7ef2.tar.gz |
Fixed up resolve discussions
Diffstat (limited to 'app/assets')
6 files changed, 32 insertions, 17 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 index bd5d8f24593..52e2846d279 100644 --- a/app/assets/javascripts/diff_notes/components/comment_resolve_btn.js.es6 +++ b/app/assets/javascripts/diff_notes/components/comment_resolve_btn.js.es6 @@ -1,9 +1,13 @@ /* eslint-disable */ -((w) => { - w.CommentAndResolveBtn = Vue.extend({ +(() => { + const CommentAndResolveBtn = Vue.extend({ props: { discussionId: String, - textareaIsEmpty: Boolean + }, + data() { + return { + textareaIsEmpty: true + } }, computed: { discussion: function () { @@ -47,4 +51,6 @@ $(`#new-discussion-note-form-${this.discussionId} .note-textarea`).off('input.comment-and-resolve-btn'); } }); + + Vue.component('comment-and-resolve-btn', CommentAndResolveBtn); })(window); diff --git a/app/assets/javascripts/diff_notes/components/resolve_btn.js.es6 b/app/assets/javascripts/diff_notes/components/resolve_btn.js.es6 index 3db0b4319b1..27af9fc96ad 100644 --- a/app/assets/javascripts/diff_notes/components/resolve_btn.js.es6 +++ b/app/assets/javascripts/diff_notes/components/resolve_btn.js.es6 @@ -1,6 +1,6 @@ /* eslint-disable */ -((w) => { - w.ResolveBtn = Vue.extend({ +(() => { + const ResolveBtn = Vue.extend({ props: { noteId: Number, discussionId: String, @@ -101,4 +101,6 @@ CommentsStore.create(this.discussionId, this.noteId, this.canResolve, this.resolved, this.resolvedBy); } }); -})(window); + + Vue.component('resolve-btn', ResolveBtn); +})(); diff --git a/app/assets/javascripts/diff_notes/components/resolve_count.js.es6 b/app/assets/javascripts/diff_notes/components/resolve_count.js.es6 index 24a99e23132..b78d63314da 100644 --- a/app/assets/javascripts/diff_notes/components/resolve_count.js.es6 +++ b/app/assets/javascripts/diff_notes/components/resolve_count.js.es6 @@ -13,6 +13,9 @@ computed: { allResolved: function () { return this.resolvedDiscussionCount === this.discussionCount; + }, + resolvedCountText() { + return this.discussionCount === 0 ? 'discussion' : 'discussions'; } } }); diff --git a/app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js.es6 b/app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js.es6 index 060034f049b..b945a09fcbe 100644 --- a/app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js.es6 +++ b/app/assets/javascripts/diff_notes/components/resolve_discussion_btn.js.es6 @@ -1,6 +1,6 @@ /* eslint-disable */ -((w) => { - w.ResolveDiscussionBtn = Vue.extend({ +(() => { + const ResolveDiscussionBtn = Vue.extend({ props: { discussionId: String, mergeRequestId: Number, @@ -54,4 +54,6 @@ CommentsStore.createDiscussion(this.discussionId, this.canResolve); } }); -})(window); + + Vue.component('resolve-discussion-btn', ResolveDiscussionBtn); +})(); diff --git a/app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6 b/app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6 index 6149bfd052a..cc2d8744fd7 100644 --- a/app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6 +++ b/app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6 @@ -10,17 +10,18 @@ $(() => { window.DiffNotesApp = new Vue({ el: '#diff-notes-app', - components: { - 'resolve-btn': ResolveBtn, - 'resolve-discussion-btn': ResolveDiscussionBtn, - 'comment-and-resolve-btn': CommentAndResolveBtn - }, methods: { compileComponents: function () { - const $components = $('resolve-btn, resolve-discussion-btn, jump-to-discussion'); + const $components = $('resolve-btn, resolve-discussion-btn, jump-to-discussion, comment-and-resolve-btn'); + if ($components.length) { $components.each(function () { - DiffNotesApp.$compile($(this).get(0)); + const $this = $(this); + const tmp = Vue.extend({ + template: $this.get(0).outerHTML, + parent: DiffNotesApp, + }); + $this.replaceWith(new tmp().$mount().$el); }); } } diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 4976eef2896..aeaf90abb77 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -647,7 +647,8 @@ var $commentBtn = form.find('comment-and-resolve-btn'); $commentBtn .attr(':discussion-id', "'" + dataHolder.data('discussionId') + "'"); - DiffNotesApp.$compile($commentBtn.get(0)); + + DiffNotesApp.compileComponents(); } form.find(".js-note-text").focus(); |