add commit page
This commit is contained in:
parent
f11fd95ddc
commit
5ed3fda233
3 changed files with 95 additions and 1 deletions
39
views/commit.eta
Normal file
39
views/commit.eta
Normal file
|
@ -0,0 +1,39 @@
|
|||
<% layout('layout') %>
|
||||
<%
|
||||
let title = it.commit.message.split('\n')[0]
|
||||
let body = it.commit.message.split('\n').slice(1).join('\n').trim()
|
||||
const titleCharLimit = 50
|
||||
if (title.length > titleCharLimit) {
|
||||
title = title.slice(0, titleCharLimit).trim() + '...'
|
||||
}
|
||||
%>
|
||||
<div class="main commit">
|
||||
<div class="contents">
|
||||
<div class="info">
|
||||
<p class="repo-name">@<%= it.commit.repository.full_name %></p>
|
||||
<p class="title"><%= title %></p>
|
||||
<% if (body) { %>
|
||||
<p class="description">
|
||||
<%= body %>
|
||||
</p>
|
||||
<% } %>
|
||||
</div>
|
||||
<div class="graphics">
|
||||
<img width="120" height="120" src="<%= it.commit.committer.avatar_url %>?size=120"></img>
|
||||
</div>
|
||||
</div>
|
||||
<div class="commit-stats info-line">
|
||||
<p><%= it.commit.stats.total %> lines changed</p>
|
||||
<p style="display: flex; gap: 0.25em; font-weight: 600;">
|
||||
<span style="color: #53d37c;">+<%= it.commit.stats.additions %></span>
|
||||
<span style="color: #d35353;">-<%= it.commit.stats.deletions %></span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="info-line">
|
||||
<img class="avatar" width="48" height="48" src="<%= it.commit.committer.avatar_url %>?size=48"></img>
|
||||
<p class="author"><%= it.commit.committer.full_name || it.commit.committer.login %></p>
|
||||
<p>committed <%= new Intl.DateTimeFormat('en-US', { dateStyle: 'long' }).format(new Date(it.commit.created_at)) %></p>
|
||||
<p>·</p>
|
||||
<p><%= it.commit.sha.slice(0, 7) %></p>
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue