aboutsummaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-02-16 20:07:21 +0800
committerGitHub <noreply@github.com>2023-02-16 20:07:21 +0800
commit2e97a77e12c7bfe9ade4a43eb7f2fbfe845028d3 (patch)
tree2a54583d4f7b9f29064bd9578a28cfd55c93a774 /web_src
parent6c90f5e4c0b4adc572c12f914beb5a04ca82328d (diff)
downloadgitea-2e97a77e12c7bfe9ade4a43eb7f2fbfe845028d3.tar.gz
gitea-2e97a77e12c7bfe9ade4a43eb7f2fbfe845028d3.zip
First step to refactor the `.hide` to `.gt-hidden` (#22916)
A separate PR from #22884 (without touching the jQuery methods)
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/features/repo-issue.js24
-rw-r--r--web_src/less/_base.less9
-rw-r--r--web_src/less/_review.less1
-rw-r--r--web_src/less/helpers.less4
4 files changed, 16 insertions, 22 deletions
diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js
index f562584c11..135e3384ad 100644
--- a/web_src/js/features/repo-issue.js
+++ b/web_src/js/features/repo-issue.js
@@ -425,10 +425,10 @@ export function initRepoPullRequestReview() {
const groupID = commentDiv.closest('div[id^="code-comments-"]').attr('id');
if (groupID && groupID.startsWith('code-comments-')) {
const id = groupID.slice(14);
- $(`#show-outdated-${id}`).addClass('hide');
- $(`#code-comments-${id}`).removeClass('hide');
- $(`#code-preview-${id}`).removeClass('hide');
- $(`#hide-outdated-${id}`).removeClass('hide');
+ $(`#show-outdated-${id}`).addClass('gt-hidden');
+ $(`#code-comments-${id}`).removeClass('gt-hidden');
+ $(`#code-preview-${id}`).removeClass('gt-hidden');
+ $(`#hide-outdated-${id}`).removeClass('gt-hidden');
commentDiv[0].scrollIntoView();
}
}
@@ -437,19 +437,19 @@ export function initRepoPullRequestReview() {
$(document).on('click', '.show-outdated', function (e) {
e.preventDefault();
const id = $(this).data('comment');
- $(this).addClass('hide');
- $(`#code-comments-${id}`).removeClass('hide');
- $(`#code-preview-${id}`).removeClass('hide');
- $(`#hide-outdated-${id}`).removeClass('hide');
+ $(this).addClass('gt-hidden');
+ $(`#code-comments-${id}`).removeClass('gt-hidden');
+ $(`#code-preview-${id}`).removeClass('gt-hidden');
+ $(`#hide-outdated-${id}`).removeClass('gt-hidden');
});
$(document).on('click', '.hide-outdated', function (e) {
e.preventDefault();
const id = $(this).data('comment');
- $(this).addClass('hide');
- $(`#code-comments-${id}`).addClass('hide');
- $(`#code-preview-${id}`).addClass('hide');
- $(`#show-outdated-${id}`).removeClass('hide');
+ $(this).addClass('gt-hidden');
+ $(`#code-comments-${id}`).addClass('gt-hidden');
+ $(`#code-preview-${id}`).addClass('gt-hidden');
+ $(`#show-outdated-${id}`).removeClass('gt-hidden');
});
$(document).on('click', 'button.comment-form-reply', async function (e) {
diff --git a/web_src/less/_base.less b/web_src/less/_base.less
index c0d7654a8d..4b65ae6812 100644
--- a/web_src/less/_base.less
+++ b/web_src/less/_base.less
@@ -1807,16 +1807,9 @@ footer {
}
}
+// TODO: refactor to use ".gt-hidden" instead (a simple search&replace should do the trick)
.hide {
display: none;
-
- &.show-outdated {
- display: none !important;
- }
-
- &.hide-outdated {
- display: none !important;
- }
}
.center:not(.popup) {
diff --git a/web_src/less/_review.less b/web_src/less/_review.less
index f0aa67b5c8..d436bc2490 100644
--- a/web_src/less/_review.less
+++ b/web_src/less/_review.less
@@ -57,7 +57,6 @@
.show-outdated,
.hide-outdated {
&:extend(.unselectable);
- display: block !important;
&:hover {
text-decoration: underline;
diff --git a/web_src/less/helpers.less b/web_src/less/helpers.less
index 74c34007e9..2b09780fb8 100644
--- a/web_src/less/helpers.less
+++ b/web_src/less/helpers.less
@@ -22,7 +22,6 @@
/* below class names match Tailwind CSS */
.gt-pointer-events-none { pointer-events: none !important; }
.gt-relative { position: relative !important; }
-.gt-hidden { display: none !important; }
.gt-mono {
font-family: var(--fonts-monospace) !important;
@@ -181,3 +180,6 @@
.gt-w-100-small { width: 100% !important; }
.gt-js-small { justify-content: flex-start !important; }
}
+
+// gt-hidden must be placed after all other "display: xxx !important" classes to win the hidden chance
+.gt-hidden { display: none !important; }