feat: add signed-in conditional blocks and fix repo home template rendering logic
- Wrapped file view, blame, and directory listing sections inside `{{if .IsSigned}}` blocks to restrict content visibility to authenticated users.
- Moved `repo/sub_menu` template inclusion into the signed-in block for both home and directory views.
- Added duplicate `{{if .IsSigned}}` check and redundant template calls for view_file, blame, and view_list to correct nested conditional structure.
- Removed `{{if .IsSigned}}` guard from the original `repo/sub_menu` call to prevent double rendering and align with new layout.
This commit is contained in:
parent
c0d105a2fa
commit
5e6e4ffb32
@ -18,7 +18,7 @@
|
|||||||
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}<button id="manage_topic" class="btn interact-fg tw-text-12">{{ctx.Locale.Tr "repo.topic.manage_topics"}}</button>{{end}}
|
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}<button id="manage_topic" class="btn interact-fg tw-text-12">{{ctx.Locale.Tr "repo.topic.manage_topics"}}</button>{{end}}
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{ if and (not .HideRepoInfo) (not .IsBlame)}}
|
{{ if and (not .IsSigned) (not .HideRepoInfo) (not .IsBlame)}}
|
||||||
|
|
||||||
<div class="repo-description gt-word-break">
|
<div class="repo-description gt-word-break">
|
||||||
Source files of this project at <a href="#bottom">bottom</a> of page. All source is under MIT license if no LICENSE file in list.
|
Source files of this project at <a href="#bottom">bottom</a> of page. All source is under MIT license if no LICENSE file in list.
|
||||||
@ -55,7 +55,7 @@
|
|||||||
<!-- HIER-->
|
<!-- HIER-->
|
||||||
{{$n := len .TreeNames}}
|
{{$n := len .TreeNames}}
|
||||||
{{$l := Eval $n "-" 1}}
|
{{$l := Eval $n "-" 1}}
|
||||||
|
{{if .IsSigned }}
|
||||||
{{if .IsViewFile}}
|
{{if .IsViewFile}}
|
||||||
{{template "repo/view_file" .}}
|
{{template "repo/view_file" .}}
|
||||||
{{else if .IsBlame}}
|
{{else if .IsBlame}}
|
||||||
@ -63,12 +63,22 @@
|
|||||||
{{else}}{{/* IsViewDirectory */}}
|
{{else}}{{/* IsViewDirectory */}}
|
||||||
|
|
||||||
<div id="bottom">
|
<div id="bottom">
|
||||||
|
{{template "repo/sub_menu" .}}
|
||||||
{{template "repo/view_list" .}}
|
{{template "repo/view_list" .}}
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{ end }}
|
||||||
{{ if .IsSigned }}
|
{{ if .IsSigned }}
|
||||||
{{template "repo/sub_menu" .}}
|
{{if .IsSigned }}
|
||||||
|
|
||||||
|
{{template "repo/sub_menu" .}}
|
||||||
|
{{template "repo/view_list" .}}
|
||||||
|
{{if .IsViewFile}}
|
||||||
|
{{template "repo/view_file" .}}
|
||||||
|
{{else if .IsBlame}}
|
||||||
|
{{template "repo/blame" .}}
|
||||||
|
{{else}}{{/* IsViewDirectory */}}
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{$isHomepage := (eq $n 0)}}
|
{{$isHomepage := (eq $n 0)}}
|
||||||
<div class="repo-button-row" data-is-homepage="{{$isHomepage}}">
|
<div class="repo-button-row" data-is-homepage="{{$isHomepage}}">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user