From 7810f4db3916aede6e86f4cbd5bf6f5eb15ae727 Mon Sep 17 00:00:00 2001 From: Mihai Parparita Date: Mon, 25 Aug 2014 22:39:27 -0700 Subject: [PATCH] Slightly prettier repository list. --- app/digest.go | 2 +- app/repos.go | 18 +++++++++++++ app/static/main.css | 48 ++++++++++++++++++++++++++++++++++ app/templates/settings.html | 52 ++++++++++++++++--------------------- 4 files changed, 89 insertions(+), 31 deletions(-) diff --git a/app/digest.go b/app/digest.go index e2a1935..4cb41db 100644 --- a/app/digest.go +++ b/app/digest.go @@ -44,7 +44,7 @@ func newDigestCommit(commit *github.RepositoryCommit, repo *Repo, location *time } 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. return commit.PushDate.Format(CommitDisplayDateFormat) } diff --git a/app/repos.go b/app/repos.go index 16e423c..84289a6 100644 --- a/app/repos.go +++ b/app/repos.go @@ -6,6 +6,10 @@ import ( "github.com/google/go-github/github" ) +const ( + VintageDateFormat = "January 2, 2006" +) + type Repos struct { AllRepos []*Repo UserRepos []*Repo @@ -38,6 +42,20 @@ func (repo *Repo) TypeAsOcticonName() string { 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) { // 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. diff --git a/app/static/main.css b/app/static/main.css index 20e8426..ea29fdd 100644 --- a/app/static/main.css +++ b/app/static/main.css @@ -3,6 +3,54 @@ body { font-size: 10pt; } +a { + color: #4183c4; + text-decoration: none; +} + #send-form { 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; +} diff --git a/app/templates/settings.html b/app/templates/settings.html index 5f64fa2..7504865 100644 --- a/app/templates/settings.html +++ b/app/templates/settings.html @@ -1,9 +1,10 @@ {{define "title"}}GitHop - Settings{{end}} {{define "repo"}} -
  • - +
  • + {{.FullName}} + {{.DisplayVintage}}
  • {{end}} @@ -30,54 +31,45 @@ You have {{len .Repos.AllRepos}} repositories:

    - + - + +{{end}} - + +{{end}} {{end}}