提交 5ec7a40b 编写于 作者: P Phil Hughes

Added jump to next discussion button

上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册