Files
2024-07-16 15:07:01 +02:00

125 lines
6.6 KiB
Cheetah

{{template "base/head" .}}
{{ $n := len .TreeNames}}
{{$l := Eval $n "-" 1}}
<div class="page-content repository file list {{if .IsBlame}}blame{{end}}">
{{template "repo/header" .}}
<div class="ui container {{if .IsBlame}}fluid padded{{end}}">
{{template "base/alert" .}}
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
<div class="ui repo-topic-edit grid form" id="topic_edit" style="display:none">
<div class="fourteen wide column">
<div class="field">
<div class="ui fluid multiple search selection dropdown">
<input type="hidden" name="topics"
value="{{range $i, $v := .Topics}}{{.Name}}{{if lt (Eval $i "+" 1) (len $.Topics)}},{{end}}{{end}}">
{{range .Topics}}
<div class="ui small label topic transition visible" data-value="{{.Name}}"
style="display: inline-block !important; cursor: default;">{{.Name}}{{svg "octicon-x" 16 "delete icon ml-3 mt-1"}}</div>
{{end}}
<div class="text"></div>
</div>
</div>
</div>
</div>
{{end}}
{{if .Repository.IsArchived}}
<div class="ui warning message">
{{.i18n.Tr "repo.archive.title"}}
</div>
{{end}}
<div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins">
{{if eq $n 0}}
<div class="left fitted item mr-0">
<div class="ui tiny primary buttons">
{{if .Permission.IsAdmin}}
<a class="ui button" href="{{.RepoLink}}/settings">
{{.i18n.Tr "repo.settings"}}
</a>
{{end}}
<a class="ui button" target="_blank" id="builds">
Builds
</a>
<a class="ui button" href="{{.RepoLink}}/commits/branch/master">
Commits
</a>
</div>
</div>
{{else}}
<div class="fitted item"><span class="ui breadcrumb repo-path"><a class="section"
href="{{.RepoLink}}/src/{{.BranchNameSubURL}}"
title="{{.Repository.Name}}">{{StringUtils.EllipsisString .Repository.Name 30}}</a>{{range $i, $v := .TreeNames}}<span
class="divider">/</span>{{if eq $i $l}}<span class="active section"
title="{{$v}}">{{StringUtils.EllipsisString $v 30}}</span>{{else}}{{ $p := index $.Paths $i}}
<span class="section"><a href="{{$.BranchLink}}/{{$p}}"
title="{{$v}}">{{StringUtils.EllipsisString $v 30}}</a></span>{{end}}{{end}}</span>
</div>
{{end}}
<!-- If home page, show new PR. If not, show breadcrumb -->
<div class="right fitted item mr-0" id="file-buttons">
<div class="ui tiny primary buttons">
{{if .Repository.CanEnableEditor}}
{{if .CanAddFile}}
<a href="{{.RepoLink}}/_new/{{.BranchName}}/{{.TreePath}}"
class="ui button">
{{.i18n.Tr "repo.editor.new_file"}}
</a>
{{end}}
{{if .CanUploadFile}}
<a href="{{.RepoLink}}/_upload/{{.BranchName}}/{{.TreePath}}"
class="ui button">
{{.i18n.Tr "repo.editor.upload_file"}}
</a>
{{end}}
{{end}}
{{if and (ne $n 0) (not .IsViewFile) (not .IsBlame) }}
<a href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath}}"
class="ui button">
{{.i18n.Tr "repo.file_history"}}
</a>
{{end}}
</div>
</div>
<div class="fitted item">
<!-- Only show clone panel in repository home page -->
{{if eq $n 0}}
<div class="ui action tiny input" id="clone-panel">
{{template "repo/clone_buttons" .}}
<button id="download-btn" class="ui basic jump dropdown icon button poping up"
data-content="{{.i18n.Tr "repo.download_archive"}}" data-variation="tiny inverted"
data-position="top right">
{{svg "octicon-download"}}
<div class="menu">
<a class="item archive-link"
data-url="{{$.RepoLink}}/archive/{{$.BranchName}}.zip">{{svg "octicon-file-zip"}}
&nbsp;{{.i18n.Tr "repo.download_zip"}}</a>
<a class="item archive-link"
data-url="{{$.RepoLink}}/archive/{{$.BranchName}}.tar.gz">{{svg "octicon-file-zip"}}
&nbsp;{{.i18n.Tr "repo.download_tar"}}</a>
<a class="item archive-link"
data-url="{{$.RepoLink}}/archive/{{$.BranchName}}.bundle">{{svg "octicon-package"}}
&nbsp;{{.i18n.Tr "repo.download_bundle"}}</a>
</div>
</button>
</div>
{{end}}
</div>
</div>
{{if .IsViewFile}}
{{template "repo/view_file" .}}
{{else if .IsBlame}}
{{template "repo/blame" .}}
{{else}}
{{if eq $n 0}}
{{template "repo/course_view_list" .}}
{{else}}
{{template "repo/view_list" .}}
{{end}}
{{end}}
</div>
</div>
{{template "base/footer" .}}
<script>
document.getElementById("builds").setAttribute("href", BUILD_URL + "/builds/{{ .Repository.Owner.Name }}/{{.Repository.Name}}")
</script>