mirror of
https://github.com/samsonjs/retrogit.git
synced 2026-04-27 15:07:43 +00:00
Slightly prettier repository list.
This commit is contained in:
parent
fac6a57e1c
commit
7810f4db39
4 changed files with 89 additions and 31 deletions
|
|
@ -44,7 +44,7 @@ func newDigestCommit(commit *github.RepositoryCommit, repo *Repo, location *time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (commit DigestCommit) DisplayDate() string {
|
func (commit DigestCommit) DisplayDate() string {
|
||||||
// Prefer the date the comit was pushed, since that's what GitHub filters
|
// Prefer the date the commit was pushed, since that's what GitHub filters
|
||||||
// and sorts by.
|
// and sorts by.
|
||||||
return commit.PushDate.Format(CommitDisplayDateFormat)
|
return commit.PushDate.Format(CommitDisplayDateFormat)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
18
app/repos.go
18
app/repos.go
|
|
@ -6,6 +6,10 @@ import (
|
||||||
"github.com/google/go-github/github"
|
"github.com/google/go-github/github"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
VintageDateFormat = "January 2, 2006"
|
||||||
|
)
|
||||||
|
|
||||||
type Repos struct {
|
type Repos struct {
|
||||||
AllRepos []*Repo
|
AllRepos []*Repo
|
||||||
UserRepos []*Repo
|
UserRepos []*Repo
|
||||||
|
|
@ -38,6 +42,20 @@ func (repo *Repo) TypeAsOcticonName() string {
|
||||||
return "repo"
|
return "repo"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (repo *Repo) TypeAsClassName() string {
|
||||||
|
if *repo.Fork {
|
||||||
|
return "fork"
|
||||||
|
}
|
||||||
|
if *repo.Private {
|
||||||
|
return "private"
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (repo *Repo) DisplayVintage() string {
|
||||||
|
return repo.CreatedAt.Format(VintageDateFormat)
|
||||||
|
}
|
||||||
|
|
||||||
func getRepos(githubClient *github.Client, user *github.User) (*Repos, error) {
|
func getRepos(githubClient *github.Client, user *github.User) (*Repos, error) {
|
||||||
// The username parameter must be left blank so that we can get all of the
|
// The username parameter must be left blank so that we can get all of the
|
||||||
// repositories the user has access to, not just ones that they own.
|
// repositories the user has access to, not just ones that they own.
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,54 @@ body {
|
||||||
font-size: 10pt;
|
font-size: 10pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #4183c4;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
#send-form {
|
#send-form {
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.repos h2 {
|
||||||
|
font-size: 32px;
|
||||||
|
font-weight: bold;
|
||||||
|
position: relative;
|
||||||
|
margin: 15px 0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.repos h2:after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
bottom: 4px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 1px;
|
||||||
|
background: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.repos h2 .avatar {
|
||||||
|
height: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.repos ul {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.repos .repo {
|
||||||
|
overflow: hidden;
|
||||||
|
margin: 5px 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.repos .repo.private .glyph {
|
||||||
|
color: #baac79;
|
||||||
|
}
|
||||||
|
|
||||||
|
.repos .repo .vintage {
|
||||||
|
padding-left: 1em;
|
||||||
|
color: #999;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
{{define "title"}}GitHop - Settings{{end}}
|
{{define "title"}}GitHop - Settings{{end}}
|
||||||
|
|
||||||
{{define "repo"}}
|
{{define "repo"}}
|
||||||
<li>
|
<li class="repo {{.TypeAsClassName}}">
|
||||||
<span class="octicon octicon-{{.TypeAsOcticonName}}"></span>
|
<span class="glyph octicon octicon-{{.TypeAsOcticonName}}"></span>
|
||||||
<a href="{{.HTMLURL}}">{{.FullName}}</a>
|
<a href="{{.HTMLURL}}">{{.FullName}}</a>
|
||||||
|
<span class="vintage">{{.DisplayVintage}}</span>
|
||||||
</li>
|
</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
|
@ -30,54 +31,45 @@
|
||||||
You have {{len .Repos.AllRepos}} repositories:
|
You have {{len .Repos.AllRepos}} repositories:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul>
|
<div class="repos">
|
||||||
<li>
|
<h2>
|
||||||
<a href="https://github.com/{{.User.Login}}">
|
<a href="https://github.com/{{.User.Login}}">
|
||||||
<img src={{.User.AvatarURL}}
|
<img src="{{.User.AvatarURL}}" class="avatar">{{.User.Login}}</a>
|
||||||
width="20"
|
</h2>
|
||||||
height="20"
|
|
||||||
border="0">{{.User.Login}}</a>
|
|
||||||
</li>
|
|
||||||
<ul>
|
<ul>
|
||||||
{{range .Repos.UserRepos}}
|
{{range .Repos.UserRepos}}
|
||||||
{{template "repo" .}}
|
{{template "repo" .}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</div>
|
||||||
|
|
||||||
<ul>
|
|
||||||
{{range .Repos.OtherUserRepos}}
|
{{range .Repos.OtherUserRepos}}
|
||||||
<li>
|
<div class="repos">
|
||||||
|
<h2>
|
||||||
<a href="https://github.com/{{.User.Login}}">
|
<a href="https://github.com/{{.User.Login}}">
|
||||||
<img src={{.User.AvatarURL}}
|
<img src="{{.User.AvatarURL}}" class="avatar">{{.User.Login}}</a>
|
||||||
width="20"
|
</h2>
|
||||||
height="20"
|
|
||||||
border="0">{{.User.Login}}</a>
|
|
||||||
</li>
|
|
||||||
<ul>
|
<ul>
|
||||||
{{range .Repos}}
|
{{range .Repos}}
|
||||||
{{template "repo" .}}
|
{{template "repo" .}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
{{range .Repos.OrgRepos}}
|
{{range .Repos.OrgRepos}}
|
||||||
<li>
|
<div class="repos">
|
||||||
|
<h2>
|
||||||
<a href="https://github.com/{{.Org.Login}}">
|
<a href="https://github.com/{{.Org.Login}}">
|
||||||
<img src={{.Org.AvatarURL}}
|
<img src="{{.Org.AvatarURL}}" class="avatar">{{.Org.Login}}</a>
|
||||||
width="20"
|
</h2>
|
||||||
height="20"
|
|
||||||
border="0">{{.Org.Login}}</a>
|
|
||||||
</li>
|
|
||||||
<ul>
|
<ul>
|
||||||
{{range .Repos}}
|
{{range .Repos}}
|
||||||
{{template "repo" .}}
|
{{template "repo" .}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
|
||||||
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue