From 774d1a0fbdadd1136b6af895f8d449b0c8db54cb Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 23 Apr 2023 20:12:36 +0200 Subject: [PATCH] Tweak pull request branch delete ui (#23951) - Move delete button to right and remove red color on it. - Remove CLI instructions when PR has been merged. Before: Screenshot 2023-04-06 at 20 21 47 After: Screenshot 2023-04-06 at 20 23 17 After (deleted): Screenshot 2023-04-06 at 20 19 30 --------- Co-authored-by: Giteabot --- options/locale/locale_en-US.ini | 6 +-- templates/repo/issue/view_content/pull.tmpl | 57 ++++++++++----------- web_src/css/repository.css | 13 +++-- 3 files changed, 41 insertions(+), 35 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index b4233d65d1..ef9990d265 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1623,11 +1623,11 @@ pulls.tab_files = Files Changed pulls.reopen_to_merge = Please reopen this pull request to perform a merge. pulls.cant_reopen_deleted_branch = This pull request cannot be reopened because the branch was deleted. pulls.merged = Merged -pulls.merged_as = The pull request has been merged as %[2]s. +pulls.merged_success = Pull request successfully merged and closed +pulls.closed = Pull request closed pulls.manually_merged = Manually merged -pulls.manually_merged_as = The pull request has been manually merged as %[2]s. +pulls.merged_info_text = The branch %s can now be deleted. pulls.is_closed = The pull request has been closed. -pulls.has_merged = The pull request has been merged. pulls.title_wip_desc = `Start the title with %s to prevent the pull request from being merged accidentally.` pulls.cannot_merge_work_in_progress = This pull request is marked as a work in progress. pulls.still_in_progress = Still in progress? diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 8b758b2ac0..899867ce72 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -109,7 +109,7 @@ {{end}}
- {{if .Issue.PullRequest.HasMerged}} -
- {{if .Issue.PullRequest.MergedCommitID}} - {{$link := printf "%s/commit/%s" $.Repository.Link (.Issue.PullRequest.MergedCommitID|PathEscape)}} - {{if eq $.Issue.PullRequest.Status 3}} - {{$.locale.Tr "repo.pulls.manually_merged_as" ($link|Escape) (ShortSha .Issue.PullRequest.MergedCommitID) | Safe}} - {{else}} - {{$.locale.Tr "repo.pulls.merged_as" ($link|Escape) (ShortSha .Issue.PullRequest.MergedCommitID) | Safe}} - {{end}} - {{else}} - {{$.locale.Tr "repo.pulls.has_merged"}} +
+
+

{{$.locale.Tr "repo.pulls.merged_success"}}

+ +
+ {{if .IsPullBranchDeletable}} +
+ +
{{end}}
- {{if .IsPullBranchDeletable}} -
-
- {{$.locale.Tr "repo.branch.delete" .HeadTarget}} -
- {{end}} {{else if .Issue.IsClosed}} -
- {{if .IsPullRequestBroken}} - {{$.locale.Tr "repo.pulls.cant_reopen_deleted_branch"}} - {{else}} - {{$.locale.Tr "repo.pulls.reopen_to_merge"}} +
+
+

{{$.locale.Tr "repo.pulls.closed"}}

+ +
+ {{if and .IsPullBranchDeletable (not .IsPullRequestBroken)}} +
+ +
{{end}}
- {{if and .IsPullBranchDeletable ( not .IsPullRequestBroken )}} -
- - {{end}} {{else if .IsPullFilesConflicted}}
{{svg "octicon-x"}} @@ -471,7 +470,7 @@
{{end}} - {{if and .ShowMergeInstructions .Issue.PullRequest.HeadRepo}} + {{if and .ShowMergeInstructions .Issue.PullRequest.HeadRepo (not .Issue.PullRequest.HasMerged) (not .Issue.IsClosed)}} {{template "repo/issue/view_content/pull_merge_instruction" (dict "locale" .locale "Issue" .Issue)}} {{end}}
diff --git a/web_src/css/repository.css b/web_src/css/repository.css index 77b41e4d16..42dd3e9e34 100644 --- a/web_src/css/repository.css +++ b/web_src/css/repository.css @@ -694,9 +694,9 @@ margin-right: 5px; } -.repository.view.issue .pull .merge.box .avatar { - margin-left: 10px; - margin-top: 10px; +.repository.view.issue .pull .merge.box .timeline-avatar { + margin-top: 3px; + margin-left: 4px; } .repository.view.issue .pull .merge.box .branch-update.grid .row { @@ -1036,6 +1036,13 @@ margin-top: -8px; } +.merge-section-info code { + border: 1px solid var(--color-light-border); + border-radius: 4px; + padding: 2px 4px; + background: var(--color-light); +} + .repository.view.issue .comment-list .comment .markup { font-size: 14px; }