git ssb

0+

noffle / %MbZg2FUvpSxIgWf1KBr…



forked from ev / sdash

Commit f764460e75e9d5babcd1180c26c9ac5ba849ac2d

format profile page a bit

Ev Bogue committed on 9/3/2016, 5:41:35 AM
Parent: 9ee51f2b87423b4fe12401dc8ecb9f21a5965aea

Files changed

index.jschanged
layouts/profile.jadechanged
index.jsView
@@ -20,9 +20,8 @@
2020 app.use(express.static('static'));
2121 app.use(favicon(__dirname + '/static/favicon.ico'));
2222
2323 app.get('/:key', function (req, res) {
24- console.log(req.params);
2524 client(function (err, sbot) {
2625 if (err) {
2726 throw err;
2827 }
@@ -31,22 +30,20 @@
3130 throw err;
3231 }
3332 key = req.params.key;
3433 pull(
35- sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'post'}}}}], limit: 1, reverse: true}),
34+ sbot.query.read({query: [{$filter: { value: { author: key, content: {type: 'post'}}}}], limit: 1, reverse: true}),
3635 pull.drain(function (data) {
3736 post = data;
38- console.log(data)
39- })
40- )
41- res.render('profile', {avatar, bloburl, key});
37+ })
38+ )
39+ res.render('profile', {avatar, bloburl, key, markdown, moment});
4240 })
4341 })
4442 });
4543
4644
4745 app.get('/:key([^/]+/[^/]+)', function (req, res) {
48- console.log(req.params);
4946 client(function (err, sbot) {
5047 if (err) {
5148 throw err;
5249 }
@@ -54,9 +51,15 @@
5451 if (err) {
5552 throw err;
5653 }
5754 key = req.params.key;
58- res.render('profile', {avatar, bloburl, key});
55+ pull(
56+ sbot.query.read({query: [{$filter: { value: { author: key, content: {type: 'post'}}}}], limit: 1, reverse: true}),
57+ pull.drain(function (data) {
58+ post = data;
59+ })
60+ )
61+ res.render('profile', {avatar, bloburl, key, markdown, moment});
5962 })
6063 })
6164 });
6265
layouts/profile.jadeView
@@ -3,5 +3,11 @@
33 block content
44 div.message
55 a(href='/#{key}'): img(src='http://localhost:8989/blobs/get/#{avatar.image}' style='width: 5em; float: left; margin-right: 1em;' class='profile')
66 p <strong>Name:</strong> <a href='/#{key}'>@#{avatar.name}</a><br /><strong>Pubkey:</strong> #{key}
7- p= post.value.content.text
7+ div.message
8+ p.small.ri: strong last #{post.value.content.type}
9+ img(src='#{bloburl}#{avatar.image}' class='avatar')
10+ p <a href='#{post.value.key}' target='_parent'>@#{avatar.name}</a>
11+ != markdown(post.value.content.text)
12+ span.date #{moment(post.value.timestamp).fromNow()}
13+

Built with git-ssb-web