From 8039a0977b7307f14f4c10c78314975566124742 Mon Sep 17 00:00:00 2001 From: delvh Date: Fri, 19 May 2023 23:20:40 +0200 Subject: [PATCH 01/11] Improve accessibility when (re-)viewing files Visually, nothing should have changed. Changes include - Convert most `` to ` + @@ -52,7 +52,7 @@ {{if $.EscapeStatus.Escaped}} {{if $row.EscapeStatus.Escaped}} - + {{end}} {{end}} diff --git a/templates/repo/diff/blob_excerpt.tmpl b/templates/repo/diff/blob_excerpt.tmpl index 7e11b33ba6e88..03fd2e0bb96dc 100644 --- a/templates/repo/diff/blob_excerpt.tmpl +++ b/templates/repo/diff/blob_excerpt.tmpl @@ -4,19 +4,19 @@ {{if eq .GetType 4}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - + {{end}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - + {{end}} {{if eq $line.GetExpandDirection 2}} - + {{end}} {{$inlineDiff := $.section.GetComputedInlineDiffFor $line $.locale}}{{/* @@ -24,7 +24,7 @@ {{else}} {{$inlineDiff := $.section.GetComputedInlineDiffFor $line $.locale}} - {{if and $line.LeftIdx $inlineDiff.EscapeStatus.Escaped}}{{end}} + {{if and $line.LeftIdx $inlineDiff.EscapeStatus.Escaped}}{{end}} {{if $line.LeftIdx}}{{end}} {{/* */}}{{if $line.LeftIdx}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.locale}}{{else}}{{/* @@ -32,7 +32,7 @@ */}}{{end}}{{/* */}} - {{if and $line.RightIdx $inlineDiff.EscapeStatus.Escaped}}{{end}} + {{if and $line.RightIdx $inlineDiff.EscapeStatus.Escaped}}{{end}} {{if $line.RightIdx}}{{end}} {{/* */}}{{if $line.RightIdx}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.locale}}{{else}}{{/* @@ -48,19 +48,19 @@ {{if eq .GetType 4}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - + {{end}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - + {{end}} {{if eq $line.GetExpandDirection 2}} - + {{end}} {{else}} @@ -68,7 +68,7 @@ {{end}} {{$inlineDiff := $.section.GetComputedInlineDiffFor $line $.locale}} - {{if $inlineDiff.EscapeStatus.Escaped}}{{end}} + {{if $inlineDiff.EscapeStatus.Escaped}}{{end}} {{$inlineDiff.Content}} diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 26b863aceae5c..0fe7cb4100dcc 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -90,13 +90,13 @@

- +
{{if $file.IsBin}} @@ -125,8 +125,8 @@ {{$.locale.Tr "repo.diff.protected"}} {{end}} {{if not (or $file.IsIncomplete $file.IsBin $file.IsSubmodule)}} - {{$.locale.Tr "repo.unescape_control_characters"}} - {{$.locale.Tr "repo.escape_control_characters"}} + + {{end}} {{if and (not $file.IsSubmodule) (not $.PageIsWiki)}} {{if $file.IsDeleted}} diff --git a/templates/repo/diff/section_split.tmpl b/templates/repo/diff/section_split.tmpl index 42aed8508459c..cebfc736552d5 100644 --- a/templates/repo/diff/section_split.tmpl +++ b/templates/repo/diff/section_split.tmpl @@ -17,22 +17,22 @@ {{if eq .GetType 4}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - + {{end}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - + {{end}} {{if eq $line.GetExpandDirection 2}} - + {{end}} {{$inlineDiff := $section.GetComputedInlineDiffFor $line $.root.locale}} - {{if $inlineDiff.EscapeStatus.Escaped}}{{end}} + {{if $inlineDiff.EscapeStatus.Escaped}}{{end}} {{/* */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.root.locale}}{{/* */}} @@ -41,7 +41,7 @@ {{- $leftDiff := ""}}{{if $line.LeftIdx}}{{$leftDiff = $section.GetComputedInlineDiffFor $line $.root.locale}}{{end}} {{- $rightDiff := ""}}{{if $match.RightIdx}}{{$rightDiff = $section.GetComputedInlineDiffFor $match $.root.locale}}{{end}} - {{if $line.LeftIdx}}{{if $leftDiff.EscapeStatus.Escaped}}{{end}}{{end}} + {{if $line.LeftIdx}}{{if $leftDiff.EscapeStatus.Escaped}}{{end}}{{end}} {{if $match.RightIdx}}{{end}} {{/* */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/* @@ -73,7 +73,7 @@ {{else}} {{$inlineDiff := $section.GetComputedInlineDiffFor $line $.root.locale}} - {{if $line.LeftIdx}}{{if $inlineDiff.EscapeStatus.Escaped}}{{end}}{{end}} + {{if $line.LeftIdx}}{{if $inlineDiff.EscapeStatus.Escaped}}{{end}}{{end}} {{if $line.LeftIdx}}{{end}} {{/* */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 2))}}{{/* @@ -88,7 +88,7 @@ */}}{{end}}{{/* */}} - {{if $line.RightIdx}}{{if $inlineDiff.EscapeStatus.Escaped}}{{end}}{{end}} + {{if $line.RightIdx}}{{if $inlineDiff.EscapeStatus.Escaped}}{{end}}{{end}} {{if $line.RightIdx}}{{end}} {{/* */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 3))}}{{/* diff --git a/templates/repo/diff/section_unified.tmpl b/templates/repo/diff/section_unified.tmpl index 8bf331f6db956..e0f7768d9d057 100644 --- a/templates/repo/diff/section_unified.tmpl +++ b/templates/repo/diff/section_unified.tmpl @@ -12,21 +12,23 @@ {{if eq .GetType 4}} {{if $.root.AfterCommitID}} - {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - - {{svg "octicon-fold-down"}} - - {{end}} - {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - - {{svg "octicon-fold-up"}} - - {{end}} - {{if eq $line.GetExpandDirection 2}} - - {{svg "octicon-fold"}} - - {{end}} +
+ {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} + + {{end}} + {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} + + {{end}} + {{if eq $line.GetExpandDirection 2}} + + {{end}} +
{{else}} {{/* for code file preview page or comment diffs on pull comment pages, do not show the expansion arrows */}} @@ -37,7 +39,11 @@ {{end}} {{$inlineDiff := $section.GetComputedInlineDiffFor $line $.root.locale -}} - {{if $inlineDiff.EscapeStatus.Escaped}}{{end}} + + {{- if $inlineDiff.EscapeStatus.Escaped -}} + + {{- end -}} + {{if eq .GetType 4}} {{/* diff --git a/templates/repo/issue/labels/labels_selector_field.tmpl b/templates/repo/issue/labels/labels_selector_field.tmpl index 00d852bba98b3..350cf631e83a0 100644 --- a/templates/repo/issue/labels/labels_selector_field.tmpl +++ b/templates/repo/issue/labels/labels_selector_field.tmpl @@ -1,10 +1,10 @@

@@ -107,7 +107,7 @@ {{if $.EscapeStatus.Escaped}} - {{if (index $.LineEscapeStatus $idx).Escaped}}{{end}} + {{if (index $.LineEscapeStatus $idx).Escaped}}{{end}} {{end}} {{$code | Safe}} diff --git a/templates/user/auth/link_account.tmpl b/templates/user/auth/link_account.tmpl index 1e059f68144ae..bef90f7896da2 100644 --- a/templates/user/auth/link_account.tmpl +++ b/templates/user/auth/link_account.tmpl @@ -4,15 +4,15 @@
{{if not .AllowOnlyInternalRegistration}} - {{.locale.Tr "auth.oauth_signup_tab"}} - +
{{end}} - {{.locale.Tr "auth.oauth_signin_tab"}} - +
diff --git a/templates/user/settings/profile.tmpl b/templates/user/settings/profile.tmpl index 92fbf5814cbac..dc1bbc84d5761 100644 --- a/templates/user/settings/profile.tmpl +++ b/templates/user/settings/profile.tmpl @@ -125,7 +125,7 @@
- {{$.locale.Tr "settings.delete_current_avatar"}} +
diff --git a/web_src/css/helpers.css b/web_src/css/helpers.css index d84fd4ba80c01..710542339870e 100644 --- a/web_src/css/helpers.css +++ b/web_src/css/helpers.css @@ -22,6 +22,7 @@ Gitea's private styles use `g-` prefix. .gt-vm { vertical-align: middle !important; } .gt-w-100 { width: 100% !important; } .gt-h-100 { height: 100% !important; } +.gt-wh-100 { width: 100% !important; height: 100% !important; } .gt-br-0 { border-radius: 0 !important; } .gt-mono { diff --git a/web_src/css/review.css b/web_src/css/review.css index d57fcc85df237..408f077edae08 100644 --- a/web_src/css/review.css +++ b/web_src/css/review.css @@ -21,7 +21,7 @@ transform: scale(1.1); } -.lines-escape a.toggle-escape-button::before { +.lines-escape .toggle-escape-button::before { visibility: visible; content: "⚠️"; font-family: var(--fonts-emoji); diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js index 8245aa57f8526..4c31c037a9bfc 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -56,9 +56,8 @@ export function initGlobalEnterQuickSubmit() { } export function initGlobalButtonClickOnEnter() { - $(document).on('keypress', '.ui.button', (e) => { - if (e.keyCode === 13 || e.keyCode === 32) { // enter key or space bar - if (e.target.nodeName === 'BUTTON') return; // button already handles space&enter correctly + $(document).on('keypress', '.ui.button:not(button,a)', (e) => { + if (e.code === ' ' || e.code === 'Enter') { $(e.target).trigger('click'); e.preventDefault(); } diff --git a/web_src/js/features/pull-view-file.js b/web_src/js/features/pull-view-file.js index e57663736a58f..daa520ea7e7f6 100644 --- a/web_src/js/features/pull-view-file.js +++ b/web_src/js/features/pull-view-file.js @@ -38,7 +38,7 @@ export function initViewedCheckboxListenerFor() { // The checkbox consists of a div containing the real checkbox with its label and the CSRF token, // hence the actual checkbox first has to be found const checkbox = form.querySelector('input[type=checkbox]'); - checkbox.addEventListener('change', function() { + checkbox.addEventListener('input', function() { // Mark the file as viewed visually - will especially change the background if (this.checked) { form.classList.add(viewedStyleClass); diff --git a/web_src/js/features/repo-diff.js b/web_src/js/features/repo-diff.js index 5a9f5ba0a2da8..d0622254bf47d 100644 --- a/web_src/js/features/repo-diff.js +++ b/web_src/js/features/repo-diff.js @@ -62,9 +62,9 @@ function initRepoDiffConversationForm() { $form.closest('.conversation-holder').replaceWith($newConversationHolder); if ($form.closest('tr').data('line-type') === 'same') { - $(`[data-path="${path}"] a.add-code-comment[data-idx="${idx}"]`).addClass('invisible'); + $(`[data-path="${path}"] .add-code-comment[data-idx="${idx}"]`).addClass('invisible'); } else { - $(`[data-path="${path}"] a.add-code-comment[data-side="${side}"][data-idx="${idx}"]`).addClass('invisible'); + $(`[data-path="${path}"] .add-code-comment[data-side="${side}"][data-idx="${idx}"]`).addClass('invisible'); } $newConversationHolder.find('.dropdown').dropdown(); initCompReactionSelector($newConversationHolder); diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js index 3723e0f627e63..cf6e09472eeb8 100644 --- a/web_src/js/features/repo-issue.js +++ b/web_src/js/features/repo-issue.js @@ -177,9 +177,9 @@ export function initRepoIssueCommentDelete() { const idx = $conversationHolder.data('idx'); const lineType = $conversationHolder.closest('tr').data('line-type'); if (lineType === 'same') { - $(`[data-path="${path}"] a.add-code-comment[data-idx="${idx}"]`).removeClass('invisible'); + $(`[data-path="${path}"] .add-code-comment[data-idx="${idx}"]`).removeClass('invisible'); } else { - $(`[data-path="${path}"] a.add-code-comment[data-side="${side}"][data-idx="${idx}"]`).removeClass('invisible'); + $(`[data-path="${path}"] .add-code-comment[data-side="${side}"][data-idx="${idx}"]`).removeClass('invisible'); } $conversationHolder.remove(); } @@ -488,7 +488,7 @@ export function initRepoPullRequestReview() { }); } - $(document).on('click', 'a.add-code-comment', async function (e) { + $(document).on('click', '.add-code-comment', async function (e) { if ($(e.target).hasClass('btn-add-single')) return; // https://github.com/go-gitea/gitea/issues/4745 e.preventDefault(); diff --git a/web_src/js/features/repo-unicode-escape.js b/web_src/js/features/repo-unicode-escape.js index 67f2df1d9a673..6a201ec4d1323 100644 --- a/web_src/js/features/repo-unicode-escape.js +++ b/web_src/js/features/repo-unicode-escape.js @@ -2,30 +2,30 @@ import $ from 'jquery'; import {hideElem, showElem} from '../utils/dom.js'; export function initUnicodeEscapeButton() { - $(document).on('click', 'a.escape-button', (e) => { + $(document).on('click', '.escape-button', (e) => { e.preventDefault(); $(e.target).parents('.file-content, .non-diff-file-content').find('.file-code, .file-view').addClass('unicode-escaped'); hideElem($(e.target)); - showElem($(e.target).siblings('a.unescape-button')); + showElem($(e.target).siblings('.unescape-button')); }); - $(document).on('click', 'a.unescape-button', (e) => { + $(document).on('click', '.unescape-button', (e) => { e.preventDefault(); $(e.target).parents('.file-content, .non-diff-file-content').find('.file-code, .file-view').removeClass('unicode-escaped'); hideElem($(e.target)); - showElem($(e.target).siblings('a.escape-button')); + showElem($(e.target).siblings('.escape-button')); }); - $(document).on('click', 'a.toggle-escape-button', (e) => { + $(document).on('click', '.toggle-escape-button', (e) => { e.preventDefault(); const fileContent = $(e.target).parents('.file-content, .non-diff-file-content'); const fileView = fileContent.find('.file-code, .file-view'); if (fileView.hasClass('unicode-escaped')) { fileView.removeClass('unicode-escaped'); - hideElem(fileContent.find('a.unescape-button')); - showElem(fileContent.find('a.escape-button')); + hideElem(fileContent.find('.unescape-button')); + showElem(fileContent.find('.escape-button')); } else { fileView.addClass('unicode-escaped'); - showElem(fileContent.find('a.unescape-button')); - hideElem(fileContent.find('a.escape-button')); + showElem(fileContent.find('.unescape-button')); + hideElem(fileContent.find('.escape-button')); } }); } From d9db226086f14da9961b81386211b84e9ed9a2db Mon Sep 17 00:00:00 2001 From: delvh Date: Sat, 20 May 2023 00:11:44 +0200 Subject: [PATCH 02/11] Remove inline style and unused helper class as per @silverwind --- templates/repo/diff/box.tmpl | 2 +- web_src/css/helpers.css | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 0fe7cb4100dcc..1bc219ffc0aee 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -90,7 +90,7 @@

- + {{- end -}} diff --git a/web_src/css/review.css b/web_src/css/review.css index 408f077edae08..95d513e631084 100644 --- a/web_src/css/review.css +++ b/web_src/css/review.css @@ -198,7 +198,7 @@ color: var(--color-text); } -a.blob-excerpt { +.blob-excerpt { color: var(--color-text-light); height: 28px; display: flex; @@ -208,7 +208,7 @@ a.blob-excerpt { background: var(--color-expand-button); } -a.blob-excerpt:hover { +.blob-excerpt:hover { background: var(--color-primary); color: var(--color-primary-contrast); } From 919d6e3651102c4c0c5db15ad6ff33d65c215e8d Mon Sep 17 00:00:00 2001 From: delvh Date: Sat, 20 May 2023 01:14:38 +0200 Subject: [PATCH 05/11] Wrap the split `expand section` buttons in a flexbox too --- templates/repo/diff/section_split.tmpl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/templates/repo/diff/section_split.tmpl b/templates/repo/diff/section_split.tmpl index cebfc736552d5..c1a79b26d4a59 100644 --- a/templates/repo/diff/section_split.tmpl +++ b/templates/repo/diff/section_split.tmpl @@ -16,21 +16,23 @@ {{if eq .GetType 4}} +
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - {{end}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - {{end}} {{if eq $line.GetExpandDirection 2}} - {{end}} +
{{$inlineDiff := $section.GetComputedInlineDiffFor $line $.root.locale}} {{if $inlineDiff.EscapeStatus.Escaped}}{{end}} {{/* From ac6a6ae94b5c5d969e3295b4788858230e9487db Mon Sep 17 00:00:00 2001 From: delvh Date: Sat, 20 May 2023 10:36:15 +0200 Subject: [PATCH 06/11] Use `` instead of "" and revert unrelated change as per @wxiaoguang --- templates/repo/issue/view_title.tmpl | 6 +++--- templates/user/auth/link_account.tmpl | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl index 6945b1c15b9ce..0857025495c0e 100644 --- a/templates/repo/issue/view_title.tmpl +++ b/templates/repo/issue/view_title.tmpl @@ -45,12 +45,12 @@ {{if .Issue.IsPull}} {{$headHref := .HeadTarget|Escape}} {{if .HeadBranchLink}} - {{$headHref = printf "%s" (.HeadBranchLink | Escape) $headHref}} + {{$headHref = printf `%s` (.HeadBranchLink | Escape) $headHref}} {{end}} - {{$headHref = printf "%s " $headHref (.locale.Tr "copy_branch") (.HeadTarget | Escape) (svg "octicon-copy" 14)}} + {{$headHref = printf `%s ` $headHref (.locale.Tr "copy_branch") (.HeadTarget | Escape) (svg "octicon-copy" 14)}} {{$baseHref := .BaseTarget|Escape}} {{if .BaseBranchLink}} - {{$baseHref = printf "%s" (.BaseBranchLink | Escape) $baseHref}} + {{$baseHref = printf `%s` (.BaseBranchLink | Escape) $baseHref}} {{end}} {{if .Issue.PullRequest.HasMerged}} {{$mergedStr:= TimeSinceUnix .Issue.PullRequest.MergedUnix $.locale}} diff --git a/templates/user/auth/link_account.tmpl b/templates/user/auth/link_account.tmpl index bef90f7896da2..1e059f68144ae 100644 --- a/templates/user/auth/link_account.tmpl +++ b/templates/user/auth/link_account.tmpl @@ -4,15 +4,15 @@
{{if not .AllowOnlyInternalRegistration}} -
{{.locale.Tr "auth.oauth_signup_tab"}} -
+ {{end}} -
{{.locale.Tr "auth.oauth_signin_tab"}} -
+
From abd97563b0d430eecf9561495d2e3aa1b9f20815 Mon Sep 17 00:00:00 2001 From: delvh Date: Sat, 20 May 2023 11:18:22 +0200 Subject: [PATCH 07/11] Rewrite key handler for `.ui.button` to only capture `` and `
` --- web_src/js/features/common-global.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js index 4c31c037a9bfc..d4d955601e6ab 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -56,7 +56,7 @@ export function initGlobalEnterQuickSubmit() { } export function initGlobalButtonClickOnEnter() { - $(document).on('keypress', '.ui.button:not(button,a)', (e) => { + $(document).on('keypress', 'div.ui.button,span.ui.button', (e) => { if (e.code === ' ' || e.code === 'Enter') { $(e.target).trigger('click'); e.preventDefault(); From 29733fdc0f415c66da9a25c1bfc0339668c09af8 Mon Sep 17 00:00:00 2001 From: delvh Date: Sat, 20 May 2023 11:32:23 +0200 Subject: [PATCH 08/11] Center the newly created excerpts too --- templates/repo/diff/blob_excerpt.tmpl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/templates/repo/diff/blob_excerpt.tmpl b/templates/repo/diff/blob_excerpt.tmpl index 03fd2e0bb96dc..01b73e86d4e73 100644 --- a/templates/repo/diff/blob_excerpt.tmpl +++ b/templates/repo/diff/blob_excerpt.tmpl @@ -3,21 +3,23 @@ {{if eq .GetType 4}} +
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - {{end}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - {{end}} {{if eq $line.GetExpandDirection 2}} - {{end}} +
{{$inlineDiff := $.section.GetComputedInlineDiffFor $line $.locale}}{{/* */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff "locale" $.locale}} From 306767b8a5a5db5c62bdb3c48b85e74e18fc2162 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 20 May 2023 12:02:58 +0200 Subject: [PATCH 09/11] rename to code-expander-button, fix styles --- templates/repo/diff/blob_excerpt.tmpl | 12 ++++++------ templates/repo/diff/section_split.tmpl | 6 +++--- templates/repo/diff/section_unified.tmpl | 6 +++--- web_src/css/repo.css | 2 +- web_src/css/review.css | 5 +++-- web_src/js/features/repo-code.js | 2 +- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/templates/repo/diff/blob_excerpt.tmpl b/templates/repo/diff/blob_excerpt.tmpl index 01b73e86d4e73..3d4b9da57b428 100644 --- a/templates/repo/diff/blob_excerpt.tmpl +++ b/templates/repo/diff/blob_excerpt.tmpl @@ -5,17 +5,17 @@
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - {{end}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - {{end}} {{if eq $line.GetExpandDirection 2}} - {{end}} @@ -50,17 +50,17 @@ {{if eq .GetType 4}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - {{end}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - {{end}} {{if eq $line.GetExpandDirection 2}} - {{end}} diff --git a/templates/repo/diff/section_split.tmpl b/templates/repo/diff/section_split.tmpl index c1a79b26d4a59..5a3517a2fdd97 100644 --- a/templates/repo/diff/section_split.tmpl +++ b/templates/repo/diff/section_split.tmpl @@ -18,17 +18,17 @@
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - {{end}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - {{end}} {{if eq $line.GetExpandDirection 2}} - {{end}} diff --git a/templates/repo/diff/section_unified.tmpl b/templates/repo/diff/section_unified.tmpl index 4f21a36d69df5..b9f67cef1cbfc 100644 --- a/templates/repo/diff/section_unified.tmpl +++ b/templates/repo/diff/section_unified.tmpl @@ -14,17 +14,17 @@
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - {{end}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - {{end}} {{if eq $line.GetExpandDirection 2}} - {{end}} diff --git a/web_src/css/repo.css b/web_src/css/repo.css index 73096a6434650..ddcc258be971a 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -2943,7 +2943,7 @@ tbody.commit-list { padding-top: 0 !important; } -td.blob-excerpt { +.blob-excerpt { background-color: var(--color-secondary-alpha-30); } diff --git a/web_src/css/review.css b/web_src/css/review.css index 95d513e631084..0abba7c3d845b 100644 --- a/web_src/css/review.css +++ b/web_src/css/review.css @@ -198,7 +198,8 @@ color: var(--color-text); } -.blob-excerpt { +.code-expander-button { + border: none; color: var(--color-text-light); height: 28px; display: flex; @@ -208,7 +209,7 @@ background: var(--color-expand-button); } -.blob-excerpt:hover { +.code-expander-button:hover { background: var(--color-primary); color: var(--color-primary-contrast); } diff --git a/web_src/js/features/repo-code.js b/web_src/js/features/repo-code.js index 9b504068f6979..73eccaf193e39 100644 --- a/web_src/js/features/repo-code.js +++ b/web_src/js/features/repo-code.js @@ -181,7 +181,7 @@ export function initRepoCodeView() { $(document).on('click', '.fold-file', ({currentTarget}) => { invertFileFolding(currentTarget.closest('.file-content'), currentTarget); }); - $(document).on('click', '.blob-excerpt', async ({currentTarget}) => { + $(document).on('click', '.code-expander-button', async ({currentTarget}) => { const url = currentTarget.getAttribute('data-url'); const query = currentTarget.getAttribute('data-query'); const anchor = currentTarget.getAttribute('data-anchor'); From b899d48cf21a7606b646383afceef5b889217e73 Mon Sep 17 00:00:00 2001 From: delvh Date: Sat, 20 May 2023 12:17:05 +0200 Subject: [PATCH 10/11] =?UTF-8?q?There=20was=20yet=20another=20uncentered?= =?UTF-8?q?=20button=20group=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/repo/diff/blob_excerpt.tmpl | 32 ++++++++++++++------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/templates/repo/diff/blob_excerpt.tmpl b/templates/repo/diff/blob_excerpt.tmpl index 3d4b9da57b428..ab8c824f11c91 100644 --- a/templates/repo/diff/blob_excerpt.tmpl +++ b/templates/repo/diff/blob_excerpt.tmpl @@ -49,21 +49,23 @@ {{if eq .GetType 4}} - {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - - {{end}} - {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - - {{end}} - {{if eq $line.GetExpandDirection 2}} - - {{end}} +
+ {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} + + {{end}} + {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} + + {{end}} + {{if eq $line.GetExpandDirection 2}} + + {{end}} +
{{else}} From 4e7297528ce796023aac4e41cb3a3800aec5ca25 Mon Sep 17 00:00:00 2001 From: delvh Date: Sat, 20 May 2023 14:58:57 +0200 Subject: [PATCH 11/11] Move `flex: 1` into the `.code-expander-button` CSS --- templates/repo/diff/blob_excerpt.tmpl | 12 ++++++------ templates/repo/diff/section_split.tmpl | 6 +++--- templates/repo/diff/section_unified.tmpl | 6 +++--- web_src/css/review.css | 1 + 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/templates/repo/diff/blob_excerpt.tmpl b/templates/repo/diff/blob_excerpt.tmpl index ab8c824f11c91..ab7abdbd7be2c 100644 --- a/templates/repo/diff/blob_excerpt.tmpl +++ b/templates/repo/diff/blob_excerpt.tmpl @@ -5,17 +5,17 @@
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - {{end}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - {{end}} {{if eq $line.GetExpandDirection 2}} - {{end}} @@ -51,17 +51,17 @@
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - {{end}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - {{end}} {{if eq $line.GetExpandDirection 2}} - {{end}} diff --git a/templates/repo/diff/section_split.tmpl b/templates/repo/diff/section_split.tmpl index 5a3517a2fdd97..cb96d64056ea2 100644 --- a/templates/repo/diff/section_split.tmpl +++ b/templates/repo/diff/section_split.tmpl @@ -18,17 +18,17 @@
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - {{end}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - {{end}} {{if eq $line.GetExpandDirection 2}} - {{end}} diff --git a/templates/repo/diff/section_unified.tmpl b/templates/repo/diff/section_unified.tmpl index b9f67cef1cbfc..d9708531592f0 100644 --- a/templates/repo/diff/section_unified.tmpl +++ b/templates/repo/diff/section_unified.tmpl @@ -14,17 +14,17 @@
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - {{end}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - {{end}} {{if eq $line.GetExpandDirection 2}} - {{end}} diff --git a/web_src/css/review.css b/web_src/css/review.css index 0abba7c3d845b..d44e98584e004 100644 --- a/web_src/css/review.css +++ b/web_src/css/review.css @@ -207,6 +207,7 @@ align-items: center; width: 100%; background: var(--color-expand-button); + flex: 1; } .code-expander-button:hover {