2
0
Files
logikonline 30417d1736
Some checks failed
Build and Release / Create Release (push) Has been skipped
Build and Release / Unit Tests (push) Failing after 45s
Build and Release / Lint (push) Failing after 1m15s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Has been skipped
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Has been skipped
Build and Release / Build Binaries (amd64, darwin, macos) (push) Has been skipped
Build and Release / Build Binaries (arm64, darwin, macos) (push) Has been skipped
Build and Release / Build Binary (linux/arm64) (push) Has been skipped
Build and Release / Integration Tests (PostgreSQL) (push) Failing after 1m41s
feat(repo): add option to hide dotfiles from code browser
Add repository setting to hide files and folders starting with "." from non-admin users in the code browser. Admins can still see dotfiles displayed dimmed. Includes database migration, settings form, filtering logic for tree views and file listings, and locale strings.
2026-01-26 22:58:41 -05:00

87 lines
4.7 KiB
Handlebars

{{/* use grid layout, still use the old ID because there are many other CSS styles depending on this ID */}}
<div id="repo-files-table" data-toggle-url="{{.RepoLink}}/settings/hidden_folders/toggle" {{if .HasFilesWithoutLatestCommit}}hx-indicator="#repo-files-table .repo-file-cell.message" hx-trigger="load" hx-swap="morph" hx-post="{{.LastCommitLoaderURL}}"{{end}}>
<div class="repo-file-line repo-file-last-commit">
{{template "repo/latest_commit" .}}
<div>{{if and .LatestCommit .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}</div>
</div>
{{$.FileIconPoolHTML}}
{{if .HasParentPath}}
<a class="repo-file-line parent-link silenced" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">
{{index $.FileIcons ".."}} ..
</a>
{{end}}
{{range $item := .Files}}
{{$entry := $item.Entry}}
{{$commit := $item.Commit}}
{{$submoduleFile := $item.SubmoduleFile}}
{{$folderFullPath := $entry.Name}}
{{if $.TreePath}}{{$folderFullPath = printf "%s/%s" $.TreePath $entry.Name}}{{end}}
{{$isHiddenFolder := false}}
{{if and $entry.IsDir $.HiddenFolderPaths}}
{{if index $.HiddenFolderPaths $folderFullPath}}{{$isHiddenFolder = true}}{{end}}
{{end}}
{{if and $.HideDotfiles (StringUtils.HasPrefix $entry.Name ".")}}{{$isHiddenFolder = true}}{{end}}
<div class="repo-file-item{{if $isHiddenFolder}} hidden-folder-dimmed{{end}}">
<div class="repo-file-cell name muted-links {{if not $commit}}notready{{end}}">
{{index $.FileIcons $entry.Name}}
{{if $entry.IsSubModule}}
{{$submoduleLink := $submoduleFile.SubmoduleWebLinkTree ctx}}
{{if $submoduleLink}}
<a class="entry-name" href="{{$submoduleLink.RepoWebLink}}" title="{{$entry.Name}}">{{$entry.Name}}</a>
@ <a class="text primary" href="{{$submoduleLink.CommitWebLink}}">{{ShortSha $submoduleFile.RefID}}</a>
{{else}}
<span class="entry-name" title="{{$entry.Name}}">{{$entry.Name}}</span>
@ {{ShortSha $submoduleFile.RefID}}
{{end}}
{{else}}
{{if $entry.IsDir}}
{{$subJumpablePathName := $entry.GetSubJumpablePathName}}
<a class="entry-name" href="{{$.TreeLink}}/{{PathEscapeSegments $subJumpablePathName}}" title="{{$subJumpablePathName}}">
{{$subJumpablePathFields := StringUtils.Split $subJumpablePathName "/"}}
{{$subJumpablePathFieldLast := (Eval (len $subJumpablePathFields) "-" 1)}}
{{if eq $subJumpablePathFieldLast 0}}
{{$subJumpablePathName}}
{{else}}
{{$subJumpablePathPrefixes := slice $subJumpablePathFields 0 $subJumpablePathFieldLast}}
<span class="text light-2">{{StringUtils.Join $subJumpablePathPrefixes "/"}}</span>/{{index $subJumpablePathFields $subJumpablePathFieldLast}}
{{end}}
</a>
{{else}}
<a class="entry-name" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a>
{{if $entry.IsLink}}
<a class="entry-symbol-link flex-text-inline" data-tooltip-content title="{{ctx.Locale.Tr "repo.find_file.follow_symlink"}}" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}?follow_symlink=1">{{svg "octicon-link" 12}}</a>
{{end}}
{{end}}
{{end}}
</div>
<div class="repo-file-cell message commit-summary loading-icon-2px">
{{if $commit}}
{{$commitLink := printf "%s/commit/%s" $.RepoLink (PathEscape $commit.ID.String)}}
{{ctx.RenderUtils.RenderCommitMessageLinkSubject $commit.Message $commitLink $.Repository}}
{{else}}
{{/* will be loaded again by LastCommitLoaderURL */}}
{{end}}
</div>
<div class="repo-file-cell age">
{{if $commit}}{{DateUtils.TimeSince $commit.Committer.When}}{{end}}
{{if and $.CanMoveToVault (not $entry.IsDir) (not $entry.IsSubModule)}}
<a class="repo-file-cell-action" href="{{$.RepoLink}}/_move-to-vault/{{PathEscapeSegments $.BranchName}}/{{if $.TreePath}}{{PathEscapeSegments $.TreePath}}/{{end}}{{PathEscapeSegments $entry.Name}}" data-tooltip-content="{{ctx.Locale.Tr "repo.editor.move_to_vault"}}">
{{svg "octicon-shield-lock" 16}}
</a>
{{end}}
{{if and $entry.IsDir (not $entry.IsSubModule) $.IsRepoAdmin}}
{{if $isHiddenFolder}}
<button class="repo-file-cell-action btn-octicon hidden-folder-toggle" data-folder-path="{{$folderFullPath}}" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.hidden_folders.unhide"}}">
{{svg "octicon-eye" 16}}
</button>
{{else}}
<button class="repo-file-cell-action btn-octicon hidden-folder-toggle" data-folder-path="{{$folderFullPath}}" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.hidden_folders.hide"}}">
{{svg "octicon-eye-closed" 16}}
</button>
{{end}}
{{end}}
</div>
</div>
{{end}}
</div>