Skip to content

Commit c8aa46d

Browse files
gary-kimtechknowlogick
authored andcommitted
Add Extra Info to Branches Page (#7461)
* 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]>
1 parent 3451660 commit c8aa46d

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

public/css/index.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,8 @@ tbody.commit-list{vertical-align:baseline}
982982
.ui.repository.list .item .time{font-size:12px;color:grey}
983983
.ui.repository.list .item .ui.tags{margin-bottom:1em}
984984
.ui.repository.list .item .ui.avatar.image{width:24px;height:24px}
985-
.ui.repository.branches .time{font-size:12px;color:grey}
985+
.ui.repository.branches .info{font-size:12px;color:grey;display:flex;white-space:pre}
986+
.ui.repository.branches .info .commit-message{max-width:72em;overflow:hidden;text-overflow:ellipsis}
986987
.ui.user.list .item{padding-bottom:25px}
987988
.ui.user.list .item:not(:first-child){border-top:1px solid #eee;padding-top:25px}
988989
.ui.user.list .item .ui.avatar.image{width:40px;height:40px}

public/less/_explore.less

+8-1
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,16 @@
6262
}
6363

6464
.ui.repository.branches {
65-
.time {
65+
.info {
6666
font-size: 12px;
6767
color: #808080;
68+
display: flex;
69+
white-space: pre;
70+
.commit-message {
71+
max-width: 72em;
72+
overflow: hidden;
73+
text-overflow: ellipsis;
74+
}
6875
}
6976
}
7077

templates/repo/branch/list.tmpl

+16-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,17 @@
1212
<table class="ui very basic striped fixed table single line">
1313
<tbody>
1414
<tr>
15-
<td>{{.DefaultBranch}}</td>
15+
<td>
16+
{{range $branch := .Branches}}
17+
{{if eq .Name $.DefaultBranch}}
18+
{{if .IsProtected}}
19+
<i class="octicon octicon-shield"></i>
20+
{{end}}
21+
{{$.DefaultBranch}}
22+
<p class="info"><i class="octicon octicon-git-commit"></i><a href="{{$.RepoLink}}/commit/{{.Commit.ID.String}}">{{ShortSha .Commit.ID.String}}</a> · <span class="commit-message">{{RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas}}</span> · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}</p>
23+
{{end}}
24+
{{end}}
25+
</td>
1626
</tr>
1727
</tbody>
1828
</table>
@@ -41,10 +51,13 @@
4151
<td>
4252
{{if .IsDeleted}}
4353
<s><a href="{{$.RepoLink}}/src/branch/{{.Name | EscapePound}}">{{.Name}}</a></s>
44-
<p class="time">{{$.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}} {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n.Lang}}</p>
54+
<p class="info">{{$.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}} {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n.Lang}}</p>
4555
{{else}}
56+
{{if .IsProtected}}
57+
<i class="octicon octicon-shield"></i>
58+
{{end}}
4659
<a href="{{$.RepoLink}}/src/branch/{{.Name | EscapePound}}">{{.Name}}</a>
47-
<p class="time">{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}</p>
60+
<p class="info"><i class="octicon octicon-git-commit"></i><a href="{{$.RepoLink}}/commit/{{.Commit.ID.String}}">{{ShortSha .Commit.ID.String}}</a> · <span class="commit-message">{{RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas}}</span> · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}</p>
4861
{{end}}
4962
</td>
5063
<td class="ui">

0 commit comments

Comments
 (0)