git ssb

30+

cel / git-ssb-web



Commit 283a5f45046e2d1ceba855b225ef2bcb28ea0fc8

reorganize feeds, adding relative times

Ev Bogue committed on 9/3/2016, 8:17:56 PM
Parent: b1774da6c9e4418f3d04d0e9d7f770345bb7e20a

Files changed

index.jschanged
static/styles.csschanged
.gitignoreadded
index.jsView
@@ -22,8 +22,9 @@
2222 var Mentions = require('ssb-mentions')
2323 var many = require('pull-many')
2424 var ident = require('pull-identify-filetype')
2525 var mime = require('mime-types')
26 +var moment = require('moment')
2627
2728 var hlCssPath = path.resolve(require.resolve('highlight.js'), '../../styles')
2829
2930 function ParamError(msg) {
@@ -108,9 +109,9 @@
108109 this.reconnect = reconnect
109110
110111 if (config.logging && config.logging.level)
111112 this.logLevel = this.logLevels.indexOf(config.logging.level)
112- this.ssbAppname = config.appname || 'gitmx'
113 + this.ssbAppname = config.appname
113114 this.isPublic = config.public
114115 this.getVotes = require('./lib/votes')(ssb)
115116 this.getMsg = asyncMemo(ssb.get)
116117 this.issues = Issues.init(ssb)
@@ -435,9 +436,9 @@
435436 [code || 200, {
436437 'Content-Type': 'text/html'
437438 }],
438439 '<!doctype html><html><head><meta charset=utf-8>',
439- '<title>' + (title || app) + " | " + "gitmx" + '</title>',
440 + '<title>' + (title || app) + '</title>',
440441 '<link rel=stylesheet href="/static/styles.css"/>',
441442 '<link rel=stylesheet href="/highlight/github.css"/>',
442443 '</head>\n',
443444 '<body>',
@@ -521,9 +522,9 @@
521522 return c.type in msgTypes
522523 || (c.type == 'post' && c.repo && c.issue)
523524 }),
524525 typeof filter == 'function' ? filter(opts) : filter,
525- pull.take(20),
526 + pull.take(50),
526527 this.addAuthorName(),
527528 query.forwards && u.pullReverse(),
528529 paginate(
529530 function (first, cb) {
@@ -562,10 +563,9 @@
562563
563564 G.renderFeedItem = function (req, msg, cb) {
564565 var self = this
565566 var c = msg.value.content
566- var msgLink = u.link([msg.key],
567- new Date(msg.value.timestamp).toLocaleString(req._locale))
567 + var msgDate = moment(new Date(msg.value.timestamp)).fromNow()
568568 var author = msg.value.author
569569 var authorLink = u.link([msg.value.author], msg.authorName)
570570 switch (c.type) {
571571 case 'git-repo':
@@ -575,36 +575,36 @@
575575 return self.getMsg(c.upstream, function (err, upstreamMsg) {
576576 if (err) return cb(null, self.serveError(req, err))
577577 self.getRepoName(upstreamMsg.author, c.upstream, done())
578578 done(function (err, repoName, upstreamName) {
579- cb(null, '<section class="collapse">' + msgLink + '<br>' +
579 + cb(null, '<section class="collapse">' +
580580 req._t('Forked', {
581581 name: authorLink,
582582 upstream: u.link([c.upstream], upstreamName),
583583 repo: u.link([msg.key], repoName)
584- }) + '</section>')
584 + }) + ' <span class="date">' + msgDate + '</span></section>')
585585 })
586586 })
587587 } else {
588588 return done(function (err, repoName) {
589589 if (err) return cb(err)
590590 var repoLink = u.link([msg.key], repoName)
591- cb(null, '<section class="collapse">' + msgLink + '<br>' +
591 + cb(null, '<section class="collapse">' +
592592 req._t('CreatedRepo', {
593593 name: authorLink,
594594 repo: repoLink
595- }) + '</section>')
595 + }) + ' <span class="date">' + msgDate + '</span></section>')
596596 })
597597 }
598598 case 'git-update':
599599 return self.getRepoName(author, c.repo, function (err, repoName) {
600600 if (err) return cb(err)
601601 var repoLink = u.link([c.repo], repoName)
602- cb(null, '<section class="collapse">' + msgLink + '<br>' +
602 + cb(null, '<section class="collapse">' +
603603 req._t('Pushed', {
604604 name: authorLink,
605605 repo: repoLink
606- }) + '</section>')
606 + }) + ' <span class="date">' + msgDate + '</span></section>')
607607 })
608608 case 'issue':
609609 case 'pull-request':
610610 var issueLink = u.link([msg.key], u.messageTitle(msg))
@@ -614,20 +614,20 @@
614614 self.getRepoName(projectMsg.author, c.project,
615615 function (err, repoName) {
616616 if (err) return cb(err)
617617 var repoLink = u.link([c.project], repoName)
618- cb(null, '<section class="collapse">' + msgLink + '<br>' +
618 + cb(null, '<section class="collapse">' +
619619 req._t('OpenedIssue', {
620620 name: authorLink,
621621 type: req._t(c.type == 'pull-request' ?
622622 'pull request' : 'issue.'),
623623 title: issueLink,
624624 project: repoLink
625- }) + '</section>')
625 + }) + ' <span class="date">' + msgDate + '</span></section>')
626626 })
627627 })
628628 case 'about':
629- return cb(null, '<section class="collapse">' + msgLink + '<br>' +
629 + return cb(null, '<section class="collapse">' +
630630 req._t('Named', {
631631 author: authorLink,
632632 target: '<tt>' + u.escape(c.about) + '</tt>',
633633 name: u.link([c.about], c.name)
@@ -637,9 +637,9 @@
637637 if (err) return cb(err)
638638 var type = pr.msg.value.content.type == 'pull-request' ?
639639 'pull request' : 'issue.'
640640 var changed = self.issues.isStatusChanged(msg, pr)
641- return cb(null, '<section class="collapse">' + msgLink + '<br>' +
641 + return cb(null, '<section class="collapse">' +
642642 req._t(changed == null ? 'CommentedOn' :
643643 changed ? 'ReopenedIssue' : 'ClosedIssue', {
644644 name: authorLink,
645645 type: req._t(type),
static/styles.cssView
@@ -1,9 +1,10 @@
11 body {
22 margin: 1em;
33 line-height: 1.6;
4- background-color: #f5f5f5;
5- font-family: "Source Sans Pro", sans-serif;
4 + color: #333;
5 + background: #white;
6 + font-family: 'Source Sans Pro', sans-serif;
67 }
78
89 article, header {
910 width: 100%;
@@ -12,9 +13,9 @@
1213 }
1314
1415 @media (min-width: 600px) {
1516 article, header {
16- width: 80%;
17 + width: 60%;
1718 }
1819 }
1920
2021 pre {
@@ -82,13 +83,13 @@
8283 background-color: white;
8384 padding: 1ex 1ex;
8485 margin-bottom: .5em;
8586 border-radius: 0;
86- border: 1px solid #eee;
87 + border-bottom: 1px solid #eee;
8788 }
8889
8990 section.collapse {
90- margin-bottom: 0;
91 + margin-bottom: 0;
9192 }
9293
9394 h1, h2, h3, h4, h5, h6 {
9495 margin: 0;
@@ -98,13 +99,13 @@
9899 margin-top: 1em;
99100 }
100101
101102 a:link, a:visited {
102- color: #333;
103 + color: #0088cc;
103104 text-decoration: none;
104105 }
105106 a:hover {
106- color: #111;
107 + color: #005580;
107108 }
108109
109110 hr {
110111 border: 0;
@@ -477,4 +478,6 @@
477478 .toggle-link {
478479 color: #006eff;
479480 font-weight: normal;
480481 }
482 +
483 +.date { font-size: .8em; color: #666;}
.gitignoreView
@@ -1,0 +1,2 @@
1 +node_modules
2 +

Built with git-ssb-web