From 33de64cb21505259338e393ef0d15ccb0f757475 Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Mon, 2 Oct 2023 06:04:32 +0200 Subject: [PATCH] link to file from its history (#27354) Fixes #3852 Fixes https://github.com/go-gitea/gitea/issues/26707 Add a button on file history which directs you to the file at the selected commit. Co-authored-by: silverwind --- options/locale/locale_en-US.ini | 2 ++ templates/repo/commits_list.tmpl | 10 ++++++++-- web_src/css/base.css | 7 ------- web_src/css/repo.css | 3 --- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 3c8c322567..7999757b83 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -97,6 +97,7 @@ locked = Locked copy = Copy copy_url = Copy URL +copy_hash = Copy hash copy_content = Copy content copy_branch = Copy branch name copy_success = Copied! @@ -1283,6 +1284,7 @@ commits.signed_by_untrusted_user = Signed by untrusted user commits.signed_by_untrusted_user_unmatched = Signed by untrusted user who does not match committer commits.gpg_key_id = GPG Key ID commits.ssh_key_fingerprint = SSH Key Fingerprint +commits.view_path=View at this point in history commit.operations = Operations commit.revert = Revert diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index 9fb2788a45..6793a81bff 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -4,8 +4,9 @@ {{ctx.Locale.Tr "repo.commits.author"}} SHA1 - {{ctx.Locale.Tr "repo.commits.message"}} + {{ctx.Locale.Tr "repo.commits.message"}} {{ctx.Locale.Tr "repo.commits.date"}} + @@ -25,7 +26,6 @@ {{end}} - {{$class := "ui sha label"}} {{if .Signature}} {{$class = (print $class " isSigned")}} @@ -76,6 +76,12 @@ {{else}} {{TimeSince .Author.When ctx.Locale}} {{end}} + +
+ + {{if $.FileName}}{{svg "octicon-file-code"}}{{end}} +
+ {{end}} diff --git a/web_src/css/base.css b/web_src/css/base.css index 1a4e9d16a1..c1ebc959d5 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1328,13 +1328,6 @@ img.ui.avatar, display: inline-block; /* not sure whether it is still needed */ } -.ui .button.copy-commit-sha { - border: 1px solid var(--color-light-border); - margin-right: 3px; - padding: 6px 6px 4px; - background: var(--color-light); -} - .ui .button.truncate { display: inline-block; max-width: 100%; diff --git a/web_src/css/repo.css b/web_src/css/repo.css index 562fb4a345..8e3448c43a 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -3051,9 +3051,6 @@ tbody.commit-list { .commit-table th.sha { display: none !important; } - .commit-table .commit-list .copy-commit-sha { - display: none !important; - } .comment-header { flex-wrap: wrap; }