Skip to content

Commit

Permalink
Add last commit information to repo branches page
Browse files Browse the repository at this point in the history
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 <gary@garykim.dev>
  • Loading branch information
gary-kim committed Jul 14, 2019
1 parent aaa6894 commit f219489
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion public/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
5 changes: 4 additions & 1 deletion public/less/_explore.less
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@
}

.ui.repository.branches {
.time {
.info {
font-size: 12px;
color: #808080;
i {
vertical-align: middle;
}
}
}

Expand Down
13 changes: 8 additions & 5 deletions templates/repo/branch/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
<tr>
<td>
{{range $branch := .Branches}}
{{if and .IsProtected (eq .Name $.DefaultBranch)}}
<i class="octicon octicon-shield"></i>
{{if eq .Name $.DefaultBranch}}
{{if .IsProtected}}
<i class="octicon octicon-shield"></i>
{{end}}
{{$.DefaultBranch}}
<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>
{{end}}
{{end}}
{{.DefaultBranch}}
</td>
</tr>
</tbody>
Expand Down Expand Up @@ -48,13 +51,13 @@
<td>
{{if .IsDeleted}}
<s><a href="{{$.RepoLink}}/src/branch/{{.Name | EscapePound}}">{{.Name}}</a></s>
<p class="time">{{$.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}} {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n.Lang}}</p>
<p class="info">{{$.i18n.Tr "repo.branch.deleted_by" .DeletedBranch.DeletedBy.Name}} {{TimeSinceUnix .DeletedBranch.DeletedUnix $.i18n.Lang}}</p>
{{else}}
{{if .IsProtected}}
<i class="octicon octicon-shield"></i>
{{end}}
<a href="{{$.RepoLink}}/src/branch/{{.Name | EscapePound}}">{{.Name}}</a>
<p class="time">{{$.i18n.Tr "org.repo_updated"}} {{TimeSince .Commit.Committer.When $.i18n.Lang}}</p>
<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>
{{end}}
</td>
<td class="ui">
Expand Down

0 comments on commit f219489

Please sign in to comment.