0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-23 12:24:36 +01:00

Add previous/next buttons to review comments (#16273)

Co-authored-by: Norwin <noerw@users.noreply.github.com>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
Jimmy Praet 2021-06-27 21:57:01 +02:00 committed by GitHub
parent 9b1b4b5433
commit fe66b612b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 0 deletions

View file

@ -27,6 +27,14 @@
</ui> </ui>
</div> </div>
<div class="df je ac fw mt-3"> <div class="df je ac fw mt-3">
<div class="ui buttons mr-2">
<button class="ui icon tiny basic button previous-conversation">
{{svg "octicon-arrow-up"}} {{$.i18n.Tr "repo.issues.previous"}}
</button>
<button class="ui icon tiny basic button next-conversation">
{{svg "octicon-arrow-down"}} {{$.i18n.Tr "repo.issues.next"}}
</button>
</div>
{{if and $.CanMarkConversation $isNotPending}} {{if and $.CanMarkConversation $isNotPending}}
<button class="ui icon tiny basic button resolve-conversation" data-origin="diff" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index .comments 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation"> <button class="ui icon tiny basic button resolve-conversation" data-origin="diff" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index .comments 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation">
{{if $resolved}} {{if $resolved}}

View file

@ -942,6 +942,28 @@ async function initRepository() {
action: 'hide' action: 'hide'
}); });
// Previous/Next code review conversation
$(document).on('click', '.previous-conversation', (e) => {
const $conversation = $(e.currentTarget).closest('.comment-code-cloud');
const $conversations = $('.comment-code-cloud:not(.hide)');
const index = $conversations.index($conversation);
if (index !== 0) {
const $previousConversation = $conversations.eq(index - 1);
const anchor = $previousConversation.find('.comment').first().attr('id');
window.location.href = `#${anchor}`;
}
});
$(document).on('click', '.next-conversation', (e) => {
const $conversation = $(e.currentTarget).closest('.comment-code-cloud');
const $conversations = $('.comment-code-cloud:not(.hide)');
const index = $conversations.index($conversation);
if (index !== $conversations.length - 1) {
const $nextConversation = $conversations.eq(index + 1);
const anchor = $nextConversation.find('.comment').first().attr('id');
window.location.href = `#${anchor}`;
}
});
// Quote reply // Quote reply
$(document).on('click', '.quote-reply', function (event) { $(document).on('click', '.quote-reply', function (event) {
$(this).closest('.dropdown').find('.menu').toggle('visible'); $(this).closest('.dropdown').find('.menu').toggle('visible');