git ssb

30+

cel / git-ssb-web



Commit ac38f3bf0c59103522861df8b3a1f1f545247977

Merge branch 'master' of ssb://%q5d5Du+9WkaSdjc8aJPZm+jMrqgo0tmfR+RcX5ZZ6H4=.sha256 into repo-index-hyperscript

mix irving committed on 11/3/2016, 8:31:28 AM
Parent: 0b95005d33b39339c34360a02ee6a8f696c7ec92
Parent: a9fe03daf5d840abc9878f2330aaec4a12666857

Files changed

lib/repos/index.jschanged
lib/util.jschanged
lib/repos/index.jsView
@@ -38,18 +38,8 @@
3838 u.readObjectString(obj, cb)
3939 })
4040 }
4141
42-function ul(props) {
43- return function (read) {
44- return cat([
45- pull.once('<ul' + (props ? ' ' + props : '') + '>'),
46- pull(read, pull.map(function (li) { return '<li>' + li + '</li>' })),
47- pull.once('</ul>')
48- ])
49- }
50-}
51-
5242 /* Repo */
5343
5444 R.serveRepoPage = function (req, repo, path) {
5545 var self = this
@@ -503,9 +493,9 @@
503493 ': ' + linkPath([repo.id, 'tree'], [rev].concat(path))
504494
505495 var location = once('')
506496 if (path.length !== 0) {
507- var link = linkPath([repo.id, 'tree'], [rev].concat(path))
497 + var link = linkPath([repo.id, 'tree'], [rev].concat(path))
508498 location = h('div', {class: 'fileLocation'}, `${req._t('Files')}: ${link}`)
509499 }
510500
511501 return cat([
@@ -913,28 +903,24 @@
913903 }
914904
915905 /* Digs */
916906
917-R.serveRepoDigs = function (req, repo) {
907 +R.serveRepoDigs = function serveRepoDigs (req, repo) {
918908 var self = this
919- return u.readNext(function (cb) {
920- var title = req._t('Digs') + ' · %{author}/%{repo}'
921- self.web.getVotes(repo.id, function (err, votes) {
922- cb(null, self.renderRepoPage(req, repo, null, null, title, cat([
923- pull.once('<section><h3>' + req._t('Digs') + '</h3>' +
924- '<div>' + req._t('Total') + ': ' + votes.upvotes + '</div>'),
925- pull(
926- pull.values(Object.keys(votes.upvoters)),
927- paramap(function (feedId, cb) {
928- self.web.about.getName(feedId, function (err, name) {
929- if (err) return cb(err)
930- cb(null, u.link([feedId], name))
909 + return u.readNext(cb => {
910 + var title = req._t('Digs') + ' · %{author}/%{repo}'
911 + self.web.getVotes(repo.id, (err, votes) => {
912 + cb(null, self.renderRepoPage(req, repo, null, null, title,
913 + h('section', [
914 + h('h3', req._t('Digs')),
915 + h('div', `${req._t('Total')}: ${votes.upvotes}`),
916 + h('ul', u.paraSourceMap(Object.keys(votes.upvoters), (feedId, cb) => {
917 + self.web.about.getName(feedId, (err, name) => {
918 + cb(null, h('li', u.link([feedId], name)))
931919 })
932- }, 8),
933- ul()
934- ),
935- pull.once('</section>')
936- ])))
920 + }))
921 + ])
922 + ))
937923 })
938924 })
939925 }
940926
lib/util.jsView
@@ -53,8 +53,16 @@
5353 pull.map(fn)
5454 )
5555 }
5656
57 +u.paraSourceMap = function paraSourceMap (source, fn) {
58 + return pull(
59 + pull.values(source),
60 + paramap(fn, 8),
61 + pull.flatten()
62 + )
63 +}
64 +
5765 u.escape = function (str) {
5866 return String(str)
5967 .replace(/&/g, '&amp;')
6068 .replace(/</g, '&lt;')

Built with git-ssb-web