Skip to content

Commit

Permalink
Show new pull request button also on subdirectories and files (#24842)
Browse files Browse the repository at this point in the history
Instead of only on the repository home page. Saves a click and makes
this functionality a bit easier to find when editing files in a
subdirectory.
  • Loading branch information
brechtvl authored May 22, 2023
1 parent da461b5 commit 32ec254
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions templates/repo/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@
<div class="repo-button-row gt-df gt-ac gt-sb gt-fw">
<div class="gt-df gt-ac gt-fw gt-gap-y-3">
{{template "repo/branch_dropdown" dict "root" . "ContainerClasses" "gt-mr-2"}}
{{$n := len .TreeNames}}
{{$l := Eval $n "-" 1}}
<!-- If home page, show new pr. If not, show breadcrumb -->
{{if and (eq $n 0) .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
{{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
{{$cmpBranch := ""}}
{{if ne .Repository.ID .BaseRepo.ID}}
{{$cmpBranch = printf "%s/%s:" (.Repository.OwnerName|PathEscape) (.Repository.Name|PathEscape)}}
Expand All @@ -79,6 +76,9 @@
{{svg "octicon-git-pull-request"}}
</a>
{{end}}
<!-- Show go to file and breadcrumbs if not on home page -->
{{$n := len .TreeNames}}
{{$l := Eval $n "-" 1}}
{{if eq $n 0}}
<a href="{{.Repository.Link}}/find/{{.BranchNameSubURL}}" class="ui compact basic button">{{.locale.Tr "repo.find_file.go_to_file"}}</a>
{{end}}
Expand Down

0 comments on commit 32ec254

Please sign in to comment.