git ssb

30+

cel / git-ssb-web



Commit 4b685a1454e2107ae586ba5cb063bffc4b3a9771

working table with pull-cat-map

mix irving committed on 10/22/2016, 3:25:18 AM
Parent: 6ca8b85e4fe5786efa07b13b0b27153cfa7ea85b

Files changed

index.jschanged
lib/repos/index.jschanged
package.jsonchanged
index.jsView
@@ -412,9 +412,8 @@
412412 else if (err) {
413413 ended = true
414414 cb(null, self.renderError(err))
415415 } else
416- console.log("DATA", data) // pull-hyperscript is currently outputting .. a function?
417416 cb(null, data)
418417 })
419418 }
420419 }
lib/repos/index.jsView
@@ -1,7 +1,9 @@
11 var url = require('url')
22 var pull = require('pull-stream')
3 +var once = pull.once
34 var cat = require('pull-cat')
5 +var catMap = require('pull-cat-map')
46 var paramap = require('pull-paramap')
57 var multicb = require('multicb')
68 var JsDiff = require('diff')
79 var GitRepo = require('pull-git-repo')
@@ -492,34 +494,33 @@
492494 var source = repo.readDir(rev,path)
493495 var pathLinks = path.length === 0 ? '' :
494496 ': ' + linkPath([repo.id, 'tree'], [rev].concat(path))
495497
498 + var location = once('')
499 + if (path.length !== 0) {
500 + var link = linkPath([repo.id, 'tree'], [rev].concat(path))
501 + location = h('div', {class: 'fileLocation'}, `${req._t('Files')}: ${link}`)
502 + }
503 +
496504 return cat([
497- pull.once(pathLinks ? '<div class="fileLocation">' + req._t('Files') + pathLinks + '</div>' : ''),
498-
499- h('table', {class: 'test'},
500- h('tr', {}, pull(
501- pull.values(['yes', null,'non']),
502- pull.filter(Boolean),
503- pull.map(val => h('td', {}, val))
504- ))
505- )
505 + location,
506 + h('table', {class: "files w-100"}, sourceMap(source, file =>
507 + h('tr', [
508 + h('td', [
509 + h('i', fileIcon(file))
510 + ]),
511 + h('td', u.link(filePath(file), file.name))
512 + ])
513 + ))
506514 ])
507- // Problem here with the pull-map
508515
509- //h('table', {class: "files w-100"}, sourceMap(source, file =>
510- //h('tr', [
511- //h('td', {}, 'yes'),
512- //h('td', {}, 'no')
513- ////h('td', [
514- ////h('i', fileType(file))
515- ////]),
516- ////h('td', [
517- ////'cat'
518- ////u.link(filePath(file), file.name)
519- ////])
520- //])
521- //))
516 + function sourceMap (source, fn) {
517 + return pull(
518 + source,
519 + pull.filter(Boolean),
520 + catMap(fn)
521 + )
522 + }
522523
523524 function fileIcon(file) {
524525 return fileType(file) === 'tree' ? '📁' : '📄'
525526 }
package.jsonView
@@ -11,8 +11,9 @@
1111 "moment": "^2.14.1",
1212 "multicb": "^1.2.1",
1313 "node-polyglot": "^1.0.0",
1414 "pull-cat": "^1.1.8",
15 + "pull-cat-map": "^1.0.0",
1516 "pull-git-pack": "^0.2.0",
1617 "pull-git-repo": "^0.6.0",
1718 "pull-identify-filetype": "^1.1.0",
1819 "pull-many": "^1.0.6",

Built with git-ssb-web