From 1fbadcea1b606763dc692b8ffd2f84b3648759cf Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sat, 16 May 2026 23:26:24 +0300 Subject: [PATCH] tree: move path breadcrumb into title bar; hide size and visibility in subdirs Show the full path (user / repo / subdir...) inline in the repo title bar instead of duplicating it above and below the menu. Drop the now unused tree_path layout. Only show the Public/Private badge and the total repo size row when viewing the repo root, and restyle the visibility badge to a softer pill. --- repo/repo_routes.v | 1 + repo/repo_template.v | 4 ++-- static/assets/version | 2 +- static/css/files.scss | 37 +++++++++++++++++++++++++++++++++ static/css/gitly.scss | 21 +++++++++++++------ templates/layout/repo_menu.html | 19 ++++++++++------- templates/layout/tree_path.html | 9 -------- templates/tree.html | 12 +++++++---- 8 files changed, 76 insertions(+), 29 deletions(-) delete mode 100644 templates/layout/tree_path.html diff --git a/repo/repo_routes.v b/repo/repo_routes.v index cc9e88d..14b262a 100644 --- a/repo/repo_routes.v +++ b/repo/repo_routes.v @@ -504,6 +504,7 @@ pub fn (mut app App) tree(mut ctx Context, username string, repo_name string, br } ctx.is_tree = true + ctx.branch = branch_name app.increment_repo_views(repo.id) or { app.info(err.str()) } diff --git a/repo/repo_template.v b/repo/repo_template.v index cd0c3a0..c241f06 100644 --- a/repo/repo_template.v +++ b/repo/repo_template.v @@ -105,7 +105,7 @@ fn (r &Repo) format_size() veb.RawHtml { if bytes <= 0 { return veb.RawHtml('') } - num, unit := format_iec_size_parts(bytes) + num, unit := format_repo_size_parts(bytes) return veb.RawHtml('${num} ${unit}') } @@ -129,7 +129,7 @@ fn (r &Repo) disk_size_bytes() i64 { return total_kib * 1024 } -fn format_iec_size_parts(bytes i64) (string, string) { +fn format_repo_size_parts(bytes i64) (string, string) { if bytes < 1024 { return bytes.str(), 'B' } diff --git a/static/assets/version b/static/assets/version index c2bee8b..2f69057 100644 --- a/static/assets/version +++ b/static/assets/version @@ -1 +1 @@ -e736ed4 \ No newline at end of file +824c6af \ No newline at end of file diff --git a/static/css/files.scss b/static/css/files.scss index c0e709b..9ee532b 100644 --- a/static/css/files.scss +++ b/static/css/files.scss @@ -77,6 +77,43 @@ grid-column: 5; } +.file.file-total { + grid-template-columns: 1fr auto; + + &:hover { + background-color: #fff; + cursor: default; + } + + .file-size { + grid-column: 2; + display: inline-flex; + align-items: center; + gap: 6px; + color: #24292e !important; + font-size: 14px; + + svg { + fill: currentColor; + color: #6a737d; + width: 14px; + height: 14px; + } + + b { + font-weight: 600; + } + } +} + +.files--with-size .file.file-total { + grid-template-columns: 1fr auto; + + .file-size { + grid-column: 2; + } +} + .files--top-files .file { grid-template-columns: 20px minmax(0, 1fr) 110px; } diff --git a/static/css/gitly.scss b/static/css/gitly.scss index a473318..c4c164b 100644 --- a/static/css/gitly.scss +++ b/static/css/gitly.scss @@ -275,13 +275,22 @@ a.repo-author, a.repo-name { } .repo-visibility { - border: 2px solid $black; + font-size: 12px; + font-weight: 500; + padding: 2px 10px; + border: 1px solid $gray; border-radius: 2em; - background-color: $black; - color: #fff; - margin-left: 5px; - font-size: 14px; - padding: 4px; + color: $gray-dark; + background-color: $white; + line-height: 1.6; + margin-left: 8px; + vertical-align: middle; +} + +.repo-visibility--private { + color: #9a6700; + border-color: #d4a72c; + background-color: #fff8c5; } .slash { diff --git a/templates/layout/repo_menu.html b/templates/layout/repo_menu.html index 5852702..981dd37 100644 --- a/templates/layout/repo_menu.html +++ b/templates/layout/repo_menu.html @@ -5,10 +5,19 @@ @end @repo.name - @if repo.is_public - Public + @if ctx.is_tree && ctx.path_split.len > 1 + @for idx, segment in ctx.path_split + @if idx > 0 +

/

+ @segment + @end + @end @else - Private + @if repo.is_public + Public + @else + Private + @end @end @if repo.user_id == ctx.user.id @@ -51,8 +60,4 @@ %ci_label - - - @repo.format_size() - diff --git a/templates/layout/tree_path.html b/templates/layout/tree_path.html deleted file mode 100644 index 21b32a3..0000000 --- a/templates/layout/tree_path.html +++ /dev/null @@ -1,9 +0,0 @@ -
- @for i, p in ctx.path_split - @p - - @if i < ctx.path_split.len - 1 - / - @end - @end -
diff --git a/templates/tree.html b/templates/tree.html index e01ee3b..d6425b8 100644 --- a/templates/tree.html +++ b/templates/tree.html @@ -90,10 +90,6 @@ @end - @if !is_top_files_mode - @include './layout/tree_path.html' - @end - @if is_top_directory
@@ -208,6 +204,14 @@ @end
@end + @if is_top_directory +
+ + + @repo.format_size() + +
+ @end
@if readme.len > 0 -- 2.39.5