Commit 5ec7a40b authored by Phil Hughes's avatar Phil Hughes

Added jump to next discussion button

parent f4746d01
(() => {
JumpToDiscussion = Vue.extend({
data: function () {
return {
discussions: CommentsStore.state,
};
},
methods: {
jumpToNextUnresolvedDiscussion: function () {
let nextUnresolvedDiscussionId;
for (const discussionId in this.discussions) {
const discussion = this.discussions[discussionId];
for (const noteId in discussion) {
const note = discussion[noteId];
if (!note.resolved) {
nextUnresolvedDiscussionId = discussionId;
break;
}
}
if (nextUnresolvedDiscussionId) break;
}
$.scrollTo(`.${nextUnresolvedDiscussionId}`, {
offset: -($('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight())
});
},
}
});
Vue.component('jump-to-discussion', JumpToDiscussion);
}());
......@@ -10,8 +10,8 @@
resolved: function () {
let resolvedCount = 0;
for (const discussionId in this.comments) {
const comments = this.comments[discussionId];
for (const discussionId in this.discussions) {
const comments = this.discussions[discussionId];
let resolved = true;
for (const noteId in comments) {
......@@ -33,7 +33,7 @@
return Object.keys(this.discussions).length;
},
allResolved: function () {
return this.resolved === this.commentsCount;
return this.resolved === this.discussionCount;
}
}
});
......
......@@ -47,9 +47,12 @@
- if current_user
#resolve-count-app{ "v-cloak" => true }
%resolve-count{ "inline-template" => true }
.line-resolve-all{ "v-show" => "commentsCount > 0" }
.line-resolve-all{ "v-show" => "discussionCount > 0" }
%span.line-resolve-text
{{ resolved }}/{{ discussionCount }} discussions resolved
%jump-to-discussion{ "inline-template" => true }
%button.btn.btn-default.has-tooltip{ "@click" => "jumpToNextUnresolvedDiscussion", title: "Jump to next unresolved discussion", data: { container: "body" } }
= icon("caret-down")
- if @commits_count.nonzero?
%ul.merge-request-tabs.nav-links.no-top.no-bottom
......
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