From f8d71fd3b51eb7697155be0a5d5b96666156b825 Mon Sep 17 00:00:00 2001 From: Gusted Date: Tue, 26 Apr 2022 22:36:39 +0200 Subject: [PATCH 1/4] Make repository file list useable on mobile - When you're browsing a repository on mobile, you're met by a giant block called the "repository file list". The current design is not useable for mobile and is a big annoyance while browsing a repo on mobile. This PR removes that annoyance by making it more suitable design when on mobile. - Adds HTML for the commit/file time to align it vertically(noticeable on mobile, not on PC). - Show all information horizontally and not vertically. - Remove the last commit message of the file, there isn't enough space on mobile to place this anywhere, so we're not trying to make a best-effort here and instead just not display it. --- templates/repo/view_list.tmpl | 10 ++++++++-- web_src/less/_repository.less | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index ef0ab866f53e8..eac66ceb50b4b 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -34,7 +34,10 @@ {{end}} - {{if .LatestCommit}}{{if .LatestCommit.Committer}}{{TimeSince .LatestCommit.Committer.When $.i18n.Lang}}{{end}}{{end}} + + + {{if .LatestCommit}}{{if .LatestCommit.Committer}}{{TimeSince .LatestCommit.Committer.When $.i18n.Lang}}{{end}}{{end}} + @@ -87,7 +90,10 @@ {{end}} - {{if $commit}}{{TimeSince $commit.Committer.When $.i18n.Lang}}{{end}} + + + {{if $commit}}{{TimeSince $commit.Committer.When $.i18n.Lang}}{{end}} + {{end}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 70f8b077ded85..428aad2ecf4d3 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -3251,4 +3251,30 @@ td.blob-excerpt { } } } + + .repository.file.list { + #repo-files-table { + .entry, + .commit-list { + display: flex !important; + padding-top: 4px; + padding-bottom: 4px; + + td.age, + th.age { + margin-left: auto !important; + } + + td.message, + span.commit-summary { + display: none !important; + } + + th .mobile-align { + display: inline-block; + padding-top: 5px; + } + } + } + } } From 7d964e7f60bfc072c2704d282beaba61da9bd57e Mon Sep 17 00:00:00 2001 From: Gusted Date: Wed, 27 Apr 2022 00:54:05 +0200 Subject: [PATCH 2/4] Remove unnecessary `!important` --- web_src/less/_repository.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 2ef563117f22f..1bb3ab39640a0 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -3249,7 +3249,7 @@ td.blob-excerpt { td.age, th.age { - margin-left: auto !important; + margin-left: auto; } td.message, From a7d5bc122ae45333df5c49bb393fd97ba17ca37d Mon Sep 17 00:00:00 2001 From: Gusted Date: Wed, 27 Apr 2022 00:56:34 +0200 Subject: [PATCH 3/4] Fix broken HTML --- templates/repo/view_list.tmpl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index eac66ceb50b4b..5dd9b2237d6c4 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -36,8 +36,9 @@ - {{if .LatestCommit}}{{if .LatestCommit.Committer}}{{TimeSince .LatestCommit.Committer.When $.i18n.Lang}}{{end}}{{end}} + {{if .LatestCommit}}{{if .LatestCommit.Committer}}{{TimeSince .LatestCommit.Committer.When $.i18n.Lang}}{{end}}{{end}} + @@ -92,8 +93,9 @@ - {{if $commit}}{{TimeSince $commit.Committer.When $.i18n.Lang}}{{end}} + {{if $commit}}{{TimeSince $commit.Committer.When $.i18n.Lang}}{{end}} + {{end}} From 21ceac153912026593f2120e5ab8ea514935fb8b Mon Sep 17 00:00:00 2001 From: Gusted Date: Wed, 27 Apr 2022 12:38:07 +0200 Subject: [PATCH 4/4] Simplify code --- templates/repo/view_list.tmpl | 12 ++---------- web_src/less/_repository.less | 6 +----- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index 5dd9b2237d6c4..ef0ab866f53e8 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -34,11 +34,7 @@ {{end}} - - - {{if .LatestCommit}}{{if .LatestCommit.Committer}}{{TimeSince .LatestCommit.Committer.When $.i18n.Lang}}{{end}}{{end}} - - + {{if .LatestCommit}}{{if .LatestCommit.Committer}}{{TimeSince .LatestCommit.Committer.When $.i18n.Lang}}{{end}}{{end}} @@ -91,11 +87,7 @@ {{end}} - - - {{if $commit}}{{TimeSince $commit.Committer.When $.i18n.Lang}}{{end}} - - + {{if $commit}}{{TimeSince $commit.Committer.When $.i18n.Lang}}{{end}} {{end}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 1bb3ab39640a0..ffbea14b99fdd 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -3243,6 +3243,7 @@ td.blob-excerpt { #repo-files-table { .entry, .commit-list { + align-items: center; display: flex !important; padding-top: 4px; padding-bottom: 4px; @@ -3256,11 +3257,6 @@ td.blob-excerpt { span.commit-summary { display: none !important; } - - th .mobile-align { - display: inline-block; - padding-top: 5px; - } } } }