summaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorparnic <github@parnic.com>2022-04-26 14:09:46 -0500
committerGitHub <noreply@github.com>2022-04-26 21:09:46 +0200
commit2347c9ebbe1cf180cfa714ea0118b79df1ced2cd (patch)
tree9ab8ab2ca4aa6d757b78aaa4dd2963796af2335d /web_src
parent3c140f0d424bc987493439eb600b221a927a933d (diff)
downloadgitea-2347c9ebbe1cf180cfa714ea0118b79df1ced2cd.tar.gz
gitea-2347c9ebbe1cf180cfa714ea0118b79df1ced2cd.zip
Allow commit status popup on /pulls page (#19507)
* Allow commit status popup on /pulls page The /pulls page doesn't contain a "repository" element, so the early-out here was preventing the commit status popup hook from working. However, the only thing the .repository element is being used for here is determining whether the popup should be on the right or on the left, so we don't actually need the element to exist for the hook to work. Pull request #19375 allows the statuses on /pulls pages to appear clickable, but this commit is required to make the popup actually work there. * Move commit statuses popup hook to dedicated func * Add missing import
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/features/repo-commit.js13
-rw-r--r--web_src/js/features/repo-legacy.js12
-rw-r--r--web_src/js/index.js8
3 files changed, 20 insertions, 13 deletions
diff --git a/web_src/js/features/repo-commit.js b/web_src/js/features/repo-commit.js
index 9a8f1a1595..a911c17392 100644
--- a/web_src/js/features/repo-commit.js
+++ b/web_src/js/features/repo-commit.js
@@ -49,3 +49,16 @@ export function initRepoCommitLastCommitLoader() {
});
});
}
+
+export function initCommitStatuses() {
+ $('.commit-statuses-trigger').each(function () {
+ const positionRight = $('.repository.file.list').length > 0 || $('.repository.diff').length > 0;
+ const popupPosition = positionRight ? 'right center' : 'left center';
+ $(this)
+ .popup({
+ on: 'click',
+ lastResort: popupPosition, // prevent error message "Popup does not fit within the boundaries of the viewport"
+ position: popupPosition,
+ });
+ });
+}
diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js
index 185a0014fa..b7e6206e53 100644
--- a/web_src/js/features/repo-legacy.js
+++ b/web_src/js/features/repo-legacy.js
@@ -423,18 +423,6 @@ export function initRepository() {
}
- // Commit statuses
- $('.commit-statuses-trigger').each(function () {
- const positionRight = $('.repository.file.list').length > 0 || $('.repository.diff').length > 0;
- const popupPosition = positionRight ? 'right center' : 'left center';
- $(this)
- .popup({
- on: 'click',
- lastResort: popupPosition, // prevent error message "Popup does not fit within the boundaries of the viewport"
- position: popupPosition,
- });
- });
-
// File list and commits
if ($('.repository.file.list').length > 0 || $('.branch-dropdown').length > 0 ||
$('.repository.commits').length > 0 || $('.repository.release').length > 0) {
diff --git a/web_src/js/index.js b/web_src/js/index.js
index 18b949e4e6..f5d72aff93 100644
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -38,7 +38,11 @@ import {
initRepoPullRequestMergeInstruction,
initRepoPullRequestReview,
} from './features/repo-issue.js';
-import {initRepoEllipsisButton, initRepoCommitLastCommitLoader} from './features/repo-commit.js';
+import {
+ initRepoEllipsisButton,
+ initRepoCommitLastCommitLoader,
+ initCommitStatuses,
+} from './features/repo-commit.js';
import {
checkAppUrl,
initFootLanguageMenu,
@@ -165,6 +169,8 @@ $(document).ready(() => {
initRepoWikiForm();
initRepository();
+ initCommitStatuses();
+
initUserAuthLinkAccountView();
initUserAuthOauth2();
initUserAuthWebAuthn();