diff --git a/app/digest.go b/app/digest.go index b94c934..c7e3d56 100644 --- a/app/digest.go +++ b/app/digest.go @@ -3,6 +3,7 @@ package githop import ( "fmt" "sort" + "strings" "time" "github.com/google/go-github/github" @@ -11,16 +12,24 @@ import ( type DigestCommit struct { DisplaySHA string URL string - Message *string + Title string + Message string Date *time.Time RepositoryCommit *github.RepositoryCommit } func newDigestCommit(commit *github.RepositoryCommit, repo *github.Repository) DigestCommit { + messagePieces := strings.SplitN(*commit.Commit.Message, "\n", 2) + title := messagePieces[0] + message := "" + if len(messagePieces) == 2 { + message = messagePieces[1] + } return DigestCommit{ DisplaySHA: (*commit.SHA)[:7], URL: fmt.Sprintf("https://github.com/%s/commit/%s", *repo.FullName, *commit.SHA), - Message: commit.Commit.Message, + Title: title, + Message: message, Date: commit.Commit.Author.Date, RepositoryCommit: commit, } @@ -75,7 +84,7 @@ func newDigest(githubClient *github.Client) (*Digest, error) { now := time.Now() digestStartTime := time.Date(now.Year()-1, now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) - digestEndTime := digestStartTime.AddDate(0, 0, 7) + digestEndTime := digestStartTime.AddDate(0, 0, 1) // Only look at repos that may have activity in the digest interval. var digestRepos []github.Repository diff --git a/app/static/digest.css b/app/static/digest.css index ab6dfab..551d468 100644 --- a/app/static/digest.css +++ b/app/static/digest.css @@ -49,23 +49,28 @@ dl > div > div { } /* Commit message */ +dl > div > div > h3 { + padding: 8px; + margin: 0; +} + dl > div > div > pre { margin: 0; - padding: 8px; + padding: 0 8px 8px; } /* Commit footer */ -dl > div > div > pre + div { +dl > div > div > div { background: #fff; border-top: solid 1px #ddd; padding: 8px; } -dl > div > div > pre + div > i { +dl > div > div > div > i { color: #666; } -dl > div > div > pre + div > a { +dl > div > div > div > a { font-family: monospace; float: right; } diff --git a/app/templates/digest.html b/app/templates/digest.html index 255de05..2baac84 100644 --- a/app/templates/digest.html +++ b/app/templates/digest.html @@ -14,7 +14,10 @@