Skip to content

Commit f219489

Browse files
committed
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]>
1 parent aaa6894 commit f219489

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
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}
986+
.ui.repository.branches .info i{vertical-align:middle}
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

+4-1
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,12 @@
6262
}
6363

6464
.ui.repository.branches {
65-
.time {
65+
.info {
6666
font-size: 12px;
6767
color: #808080;
68+
i {
69+
vertical-align: middle;
70+
}
6871
}
6972
}
7073

templates/repo/branch/list.tmpl

+8-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@
1414
<tr>
1515
<td>
1616
{{range $branch := .Branches}}
17-
{{if and .IsProtected (eq .Name $.DefaultBranch)}}
18-
<i class="octicon octicon-shield"></i>
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> · {{Safe (EllipsisString (Printf "%s" (RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas)) 72)}} · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}</p>
1923
{{end}}
2024
{{end}}
21-
{{.DefaultBranch}}
2225
</td>
2326
</tr>
2427
</tbody>
@@ -48,13 +51,13 @@
4851
<td>
4952
{{if .IsDeleted}}
5053
<s><a href="{{$.RepoLink}}/src/branch/{{.Name | EscapePound}}">{{.Name}}</a></s>
51-
<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>
5255
{{else}}
5356
{{if .IsProtected}}
5457
<i class="octicon octicon-shield"></i>
5558
{{end}}
5659
<a href="{{$.RepoLink}}/src/branch/{{.Name | EscapePound}}">{{.Name}}</a>
57-
<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> · {{Safe (EllipsisString (Printf "%s" (RenderCommitMessage .Commit.CommitMessage $.RepoLink $.Repository.ComposeMetas)) 72)}} · {{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}</p>
5861
{{end}}
5962
</td>
6063
<td class="ui">

0 commit comments

Comments
 (0)