refactor, redesign
This commit is contained in:
parent
83a9e85d3d
commit
ff48d782c3
5 changed files with 46 additions and 20 deletions
|
@ -1,5 +1,6 @@
|
|||
<% layout('layout') %>
|
||||
<%
|
||||
let description = it.repo.description?.replace(/https?:\/\/([\S]+)/g, '$1')
|
||||
function prettyNumber(number) {
|
||||
if (number < 1000) return number
|
||||
return Math.floor(number / 1000)+'k'
|
||||
|
@ -8,18 +9,18 @@
|
|||
<div class="main repo">
|
||||
<div class="contents">
|
||||
<div class="info">
|
||||
<p class="author"><span><%= it.repo.owner.full_name %></span><span class="username">@<%= it.repo.owner.login %></span></p>
|
||||
<p class="author"><span><%= it.repo.owner.full_name || it.repo.owner.login %></span><span class="username">@<%= it.repo.owner.login %></span></p>
|
||||
<p class="title"><%= it.repo.name %></p>
|
||||
<% if (it.repo.description) { %>
|
||||
<p class="description"><%= it.repo.description %></p>
|
||||
<% if (description) { %>
|
||||
<p class="description"><%= description %></p>
|
||||
<% } %>
|
||||
</div>
|
||||
<div class="graphics">
|
||||
<img width="120" height="120" src="<%= it.repo.avatar_url || it.repo.owner.avatar_url %>"></img>
|
||||
</div>
|
||||
</div>
|
||||
<% if (it.repo.open_issues_count > 0 || it.repo.stars_count > 0 || it.repo.forks_count > 0) { %>
|
||||
<div class="info-line">
|
||||
<div class="info-line">
|
||||
<% if (it.repo.open_issues_count > 0 || it.repo.stars_count > 0 || it.repo.forks_count > 0) { %>
|
||||
<div class="fact">
|
||||
<p class="fact-heading"><%= prettyNumber(it.repo.open_issues_count) %></p>
|
||||
<p class="fact-subtitle"><%= (it.repo.open_issues_count) != 1 ? 'Issues' : 'Issue' %></p>
|
||||
|
@ -32,6 +33,10 @@
|
|||
<p class="fact-heading"><%= prettyNumber(it.repo.forks_count) %></p>
|
||||
<p class="fact-subtitle"><%= (it.repo.forks_count) != 1 ? 'Forks' : 'Fork' %></p>
|
||||
</div>
|
||||
<% } %>
|
||||
<div class="fact">
|
||||
<p class="fact-subtitle">Last updated</p>
|
||||
<p class="fact-heading"><%= new Intl.DateTimeFormat('en-US', { dateStyle: 'long' }).format(new Date(it.repo.updated_at)) %></p>
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue