From aaa6894fd6d95cbbae6f29ea47b2f7e301d5b1ec Mon Sep 17 00:00:00 2001 From: Gary Kim Date: Sun, 14 Jul 2019 09:37:39 +0800 Subject: [PATCH 1/3] Add branch protection information to branches page This change will add a tag on the ui that indicates whether a branch is protected on the repository branches page. Signed-off-by: Gary Kim --- templates/repo/branch/list.tmpl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 2028797bdb9bc..04c9e1dad5b68 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -12,7 +12,14 @@ - +
{{.DefaultBranch}} + {{range $branch := .Branches}} + {{if and .IsProtected (eq .Name $.DefaultBranch)}} + + {{end}} + {{end}} + {{.DefaultBranch}} +
@@ -43,6 +50,9 @@ {{.Name}}

{{$.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}} {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n.Lang}}

{{else}} + {{if .IsProtected}} + + {{end}} {{.Name}}

{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}

{{end}} From f219489564b626b5c6cb3ed5afcdc03be52c12c4 Mon Sep 17 00:00:00 2001 From: Gary Kim Date: Sun, 14 Jul 2019 10:28:05 +0800 Subject: [PATCH 2/3] Add last commit information to repo branches page This change adds the ID and commit message of the last commit on a branch to the branches page for repositories. Signed-off-by: Gary Kim --- public/css/index.css | 3 ++- public/less/_explore.less | 5 ++++- templates/repo/branch/list.tmpl | 13 ++++++++----- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/public/css/index.css b/public/css/index.css index 0630cb6ed567a..764cd325fc4ca 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -982,7 +982,8 @@ tbody.commit-list{vertical-align:baseline} .ui.repository.list .item .time{font-size:12px;color:grey} .ui.repository.list .item .ui.tags{margin-bottom:1em} .ui.repository.list .item .ui.avatar.image{width:24px;height:24px} -.ui.repository.branches .time{font-size:12px;color:grey} +.ui.repository.branches .info{font-size:12px;color:grey} +.ui.repository.branches .info i{vertical-align:middle} .ui.user.list .item{padding-bottom:25px} .ui.user.list .item:not(:first-child){border-top:1px solid #eee;padding-top:25px} .ui.user.list .item .ui.avatar.image{width:40px;height:40px} diff --git a/public/less/_explore.less b/public/less/_explore.less index c5065a35bc240..bc47c77377641 100644 --- a/public/less/_explore.less +++ b/public/less/_explore.less @@ -62,9 +62,12 @@ } .ui.repository.branches { - .time { + .info { font-size: 12px; color: #808080; + i { + vertical-align: middle; + } } } diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 04c9e1dad5b68..cd73cc2f4a82b 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -14,11 +14,14 @@ {{range $branch := .Branches}} - {{if and .IsProtected (eq .Name $.DefaultBranch)}} - + {{if eq .Name $.DefaultBranch}} + {{if .IsProtected}} + + {{end}} + {{$.DefaultBranch}} +

{{ShortSha .Commit.ID.String}} · {{Safe (EllipsisString (Printf "%s" (RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas)) 72)}} · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}

{{end}} {{end}} - {{.DefaultBranch}} @@ -48,13 +51,13 @@ {{if .IsDeleted}} {{.Name}} -

{{$.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}} {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n.Lang}}

+

{{$.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}} {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n.Lang}}

{{else}} {{if .IsProtected}} {{end}} {{.Name}} -

{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}

+

{{ShortSha .Commit.ID.String}} · {{Safe (EllipsisString (Printf "%s" (RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas)) 72)}} · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}

{{end}} From cbec921867fd504628c323fdb7049c50a686f98e Mon Sep 17 00:00:00 2001 From: Gary Kim Date: Sun, 14 Jul 2019 18:06:00 +0800 Subject: [PATCH 3/3] Make branch page commit message truncate in css rather then template The truncating of commit messages shown under branches in the repository branches page has been moved to using css rather then the Go template as the template was causing some issues when the commit messaged had a link when rendered. This commit also makes the commit message paragraph itself use flex in order to make managing its elements easier. Signed-off-by: Gary Kim --- public/css/index.css | 4 ++-- public/less/_explore.less | 8 ++++++-- templates/repo/branch/list.tmpl | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/public/css/index.css b/public/css/index.css index 764cd325fc4ca..4a7dfb2824bf0 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -982,8 +982,8 @@ tbody.commit-list{vertical-align:baseline} .ui.repository.list .item .time{font-size:12px;color:grey} .ui.repository.list .item .ui.tags{margin-bottom:1em} .ui.repository.list .item .ui.avatar.image{width:24px;height:24px} -.ui.repository.branches .info{font-size:12px;color:grey} -.ui.repository.branches .info i{vertical-align:middle} +.ui.repository.branches .info{font-size:12px;color:grey;display:flex;white-space:pre} +.ui.repository.branches .info .commit-message{max-width:72em;overflow:hidden;text-overflow:ellipsis} .ui.user.list .item{padding-bottom:25px} .ui.user.list .item:not(:first-child){border-top:1px solid #eee;padding-top:25px} .ui.user.list .item .ui.avatar.image{width:40px;height:40px} diff --git a/public/less/_explore.less b/public/less/_explore.less index bc47c77377641..11dacb7285b96 100644 --- a/public/less/_explore.less +++ b/public/less/_explore.less @@ -65,8 +65,12 @@ .info { font-size: 12px; color: #808080; - i { - vertical-align: middle; + display: flex; + white-space: pre; + .commit-message { + max-width: 72em; + overflow: hidden; + text-overflow: ellipsis; } } } diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index cd73cc2f4a82b..a284de2c90327 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -19,7 +19,7 @@ {{end}} {{$.DefaultBranch}} -

{{ShortSha .Commit.ID.String}} · {{Safe (EllipsisString (Printf "%s" (RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas)) 72)}} · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}

+

{{ShortSha .Commit.ID.String}} · {{RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas}} · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}

{{end}} {{end}} @@ -57,7 +57,7 @@ {{end}} {{.Name}} -

{{ShortSha .Commit.ID.String}} · {{Safe (EllipsisString (Printf "%s" (RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas)) 72)}} · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}

+

{{ShortSha .Commit.ID.String}} · {{RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas}} · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}

{{end}}