aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js
diff options
context:
space:
mode:
authorJimmy Praet <jimmy.praet@telenet.be>2021-06-27 21:57:01 +0200
committerGitHub <noreply@github.com>2021-06-27 20:57:01 +0100
commitfe66b612b5234142304cd7c6c97a14017bca066c (patch)
treee97b7c63324e9686edc28375b6dad8494bb34970 /web_src/js
parent9b1b4b543358c212a3da2b480d361d0c1375b279 (diff)
downloadgitea-fe66b612b5234142304cd7c6c97a14017bca066c.tar.gz
gitea-fe66b612b5234142304cd7c6c97a14017bca066c.zip
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>
Diffstat (limited to 'web_src/js')
-rw-r--r--web_src/js/index.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/web_src/js/index.js b/web_src/js/index.js
index 67548f5d9d..f1f41ce747 100644
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -942,6 +942,28 @@ async function initRepository() {
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
$(document).on('click', '.quote-reply', function (event) {
$(this).closest('.dropdown').find('.menu').toggle('visible');