Fix repo home row-right grow (#32763)

Fix #32753
This commit is contained in:
wxiaoguang 2024-12-09 00:16:32 +08:00 committed by GitHub
parent 23471e1333
commit c986718965
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 8 deletions

View File

@ -102,7 +102,8 @@
{{end}} {{end}}
</div> </div>
<div class="repo-button-row-right"> {{/* by default, the row-right flex grows, but on non-root tree path, it should not because the row-left might contain a long path */}}
<div class="repo-button-row-right {{if not $isTreePathRoot}}tw-flex-grow-0{{end}}">
<!-- Only show clone panel in repository home page --> <!-- Only show clone panel in repository home page -->
{{if $isTreePathRoot}} {{if $isTreePathRoot}}
<div class="clone-panel ui action tiny input"> <div class="clone-panel ui action tiny input">
@ -122,7 +123,6 @@
</button> </button>
{{template "repo/clone_script" .}}{{/* the script will update `.js-clone-url` and related elements */}} {{template "repo/clone_script" .}}{{/* the script will update `.js-clone-url` and related elements */}}
</div> </div>
{{template "repo/cite/cite_modal" .}}
{{end}} {{end}}
{{if and (not $isTreePathRoot) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}} {{if and (not $isTreePathRoot) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}}
<a class="ui button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}"> <a class="ui button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}">

View File

@ -43,22 +43,23 @@
{{end}} {{end}}
{{if .ReadmeExist}} {{if .ReadmeExist}}
<div class="flex-item-body tw-mt-2"> <div class="flex-item-body tw-mt-2">
<a class="tw-flex tw-items-center tw-gap-2 muted" href="{{.TreeLink}}/{{.FileName}}"> <a class="flex-text-block muted" href="{{.TreeLink}}/{{.FileName}}">
{{svg "octicon-book"}}{{ctx.Locale.Tr "readme"}} {{svg "octicon-book"}} {{ctx.Locale.Tr "readme"}}
</a> </a>
</div> </div>
{{end}} {{end}}
{{if .DetectedRepoLicenses}} {{if .DetectedRepoLicenses}}
<div class="flex-item-body"> <div class="flex-item-body">
<a class="tw-flex tw-items-center tw-gap-2 muted" href="{{.RepoLink}}/src/{{.Repository.DefaultBranch}}/{{PathEscapeSegments .LicenseFileName}}" title="{{StringUtils.Join .DetectedRepoLicenses ", "}}"> <a class="flex-text-block muted" href="{{.RepoLink}}/src/{{.Repository.DefaultBranch}}/{{PathEscapeSegments .LicenseFileName}}" title="{{StringUtils.Join .DetectedRepoLicenses ", "}}">
{{svg "octicon-law"}}{{if eq (len .DetectedRepoLicenses) 1}}{{index .DetectedRepoLicenses 0}}{{else}}{{ctx.Locale.Tr "repo.multiple_licenses"}}{{end}} {{svg "octicon-law"}} {{if eq (len .DetectedRepoLicenses) 1}}{{index .DetectedRepoLicenses 0}}{{else}}{{ctx.Locale.Tr "repo.multiple_licenses"}}{{end}}
</a> </a>
</div> </div>
{{end}} {{end}}
{{if .CitiationExist}} {{if .CitiationExist}}
<div class="flex-item-body"> <div class="flex-item-body">
<a class="tw-flex tw-items-center tw-gap-2 muted" id="cite-repo-button"> {{template "repo/cite/cite_modal" .}}
{{svg "octicon-cross-reference"}}{{ctx.Locale.Tr "repo.cite_this_repo"}} <a class="flex-text-block muted" id="cite-repo-button">
{{svg "octicon-cross-reference"}} {{ctx.Locale.Tr "repo.cite_this_repo"}}
</a> </a>
</div> </div>
{{end}} {{end}}