Commit 96337c62e3ddfa9c60cef474a2d2f980e1239221
tweak to accomidate patch-gatherings
mix irving committed on 5/1/2017, 6:52:32 AMParent: fa2f027218aa9786af67ffb14c515c69fed1002e
Files changed
message/html/render/about.js | changed |
message/html/render/about.js | |||
---|---|---|---|
@@ -19,8 +19,11 @@ | |||
19 | 19 … | ||
20 | 20 … | function about (msg, opts) { | |
21 | 21 … | if (msg.value.content.type !== 'about') return | |
22 | 22 … | ||
23 … | + const { name, description, image } = msg.value.content | ||
24 … | + if (!name && !description && !image) return | ||
25 … | + | ||
23 | 26 … | const element = api.message.html.layout(msg, extend({ | |
24 | 27 … | content: renderContent(msg), | |
25 | 28 … | layout: 'default' | |
26 | 29 … | }, opts)) | |
@@ -35,14 +38,20 @@ | |||
35 | 38 … | // TODO : build better normalizers | |
36 | 39 … | if (image && ref.isBlob(image.link)) image = image.link | |
37 | 40 … | about = about || link | |
38 | 41 … | ||
42 … | + const metaData = [ | ||
43 … | + when(name, h('div', [ h('strong', 'Name: '), name ])), | ||
44 … | + when(description, h('div', [ h('strong', 'Description: '), description ])), | ||
45 … | + when(image, h('img', { src: api.blob.sync.url(image) })) | ||
46 … | + ] | ||
47 … | + | ||
39 | 48 … | if (!ref.isFeed(about)) { | |
40 | 49 … | return [ | |
41 | 50 … | 'Describes ', | |
42 | 51 … | h('a', { href: about }, [about.slice(0, 7), '...']), | |
43 | 52 … | ' as: ', | |
44 | - name | ||
53 … | + ...metaData | ||
45 | 54 … | ] | |
46 | 55 … | } | |
47 | 56 … | ||
48 | 57 … | const target = author === about | |
@@ -50,11 +59,9 @@ | |||
50 | 59 … | : api.about.html.link(about) | |
51 | 60 … | ||
52 | 61 … | return [ | |
53 | 62 … | 'Declares the following about ', target, | |
54 | - when(name, h('div', [ h('strong', 'Name: '), name ])), | ||
55 | - when(description, h('div', [ h('strong', 'Description: '), description ])), | ||
56 | - when(image, h('img', { src: api.blob.sync.url(image) })) | ||
63 … | + ...metaData | ||
57 | 64 … | ] | |
58 | 65 … | } | |
59 | 66 … | } | |
60 | 67 … |
Built with git-ssb-web