aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-08-26 18:44:08 -0700
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-08-26 18:59:40 -0700
commitf1a5a804e834cebf71c10b83197b11d8fadd26a4 (patch)
tree80eee9e887ab7a16e7eb5868217b5e13b61c8540 /lib
parent6c1319aa3220157ed76d0c897ae085605a9d65c2 (diff)
downloadpatchfoo-f1a5a804e834cebf71c10b83197b11d8fadd26a4.tar.gz
patchfoo-f1a5a804e834cebf71c10b83197b11d8fadd26a4.zip
Render bookclub messages better
Diffstat (limited to 'lib')
-rw-r--r--lib/render-msg.js56
1 files changed, 35 insertions, 21 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js
index 9a08a5d..aee5e4d 100644
--- a/lib/render-msg.js
+++ b/lib/render-msg.js
@@ -545,10 +545,15 @@ var knownAboutProps = {
startDateTime: true,
endDateTime: true,
location: true,
- /*
+ review: true,
rating: true,
ratingType: true,
- */
+ ratingMax: true,
+ authors: true,
+ shelve: true,
+ genre: true,
+ series: true,
+ seriesNo: true,
'talenet-version': true,
}
@@ -611,16 +616,30 @@ RenderMsg.prototype.about = function (cb) {
h('small', '> ', this.link1(this.c.root, done()))
) : '',
isSelf ? 'self-describes as ' : [
- 'describes ',
+ this.c.review ? 'reviews' : 'describes', ' ',
!this.c.about ? ''
: showComputedName ? this.link1(this.c.about, done())
: h('a', {href: this.toUrl(this.c.about)}, truncate(this.c.about, 10)),
- ' as '
+ ': '
],
this.c.name ? [h('ins', String(this.c.name)), ' '] : '',
this.c.title ? h('h3', String(this.c.title)) : '',
+ this.c.series || this.c.seriesNo ? this.renderSeries(this.c) : '',
+ this.c.authors ? h('div', h('em', {title: 'authors'}, String(this.c.authors))) : '',
+ this.c.rating || this.c.ratingMax || this.c.ratingType ? h('div', [
+ 'rating: ',
+ String(this.c.rating),
+ this.c.ratingMax ? '/' + this.c.ratingMax : '',
+ this.c.ratingType ? [' ',
+ h('span', {innerHTML: u.unwrapP(this.render.markdown(this.c.ratingType))})
+ ] : ''
+ ]) : '',
+ this.c.genre ? h('div', ['genre: ', h('u', String(this.c.genre))]) : '',
+ this.c.shelve ? h('div', ['shelf: ', h('u', String(this.c.shelve))]) : '',
this.c.description ? h('div',
{innerHTML: this.render.markdown(this.c.description)}) : '',
+ this.c.review ? h('blockquote',
+ {innerHTML: this.render.markdown(this.c.review)}) : '',
this.c.attendee ? h('div',
this.link1(this.c.attendee.link, done()),
this.c.attendee.remove ? ' is not attending' : ' is attending'
@@ -635,32 +654,18 @@ RenderMsg.prototype.about = function (cb) {
src: this.render.imageUrl(img),
alt: ' ',
})) : '',
- /*
- this.c.rating != null ? this.aboutRating() : '',
- */
extras ? this.valueTable(extras, 1, done())
: ''
], elCb)
done(cb)
}
-/*
- * disabled until it's clearer how to do this -cel
RenderMsg.prototype.aboutRating = function (cb) {
var rating = Number(this.c.rating)
- var type = this.c.ratingType || '★'
- var text = rating + ' ' + type
- if (isNaN(rating)) return 'rating: ' + text
- if (rating > 5) rating = 5
- var el = h('div', {title: text})
- for (var i = 0; i < rating; i++) {
- el.appendChild(h('span',
- {innerHTML: u.unwrapP(this.render.markdown(type) + ' ')}
- ))
- }
- return el
+ var max = Number(this.c.ratingMax)
+ var type = this.c.ratingType
+
}
-*/
RenderMsg.prototype.contact = function (cb) {
var self = this
@@ -1472,6 +1477,14 @@ RenderMsg.prototype.acmeChallengesHttp01 = function (cb) {
), cb)
}
+RenderMsg.prototype.renderSeries = function (o) {
+ return h('div', [
+ o.series ? h('span', {title: 'series'}, o.series) : '',
+ o.series && o.seriesNo ? ': ' : '',
+ o.seriesNo ? h('span', {title: 'series no'}, o.seriesNo) : '',
+ ])
+}
+
RenderMsg.prototype.bookclub = function (cb) {
var self = this
var props = self.c.common || self.c
@@ -1487,6 +1500,7 @@ RenderMsg.prototype.bookclub = function (cb) {
})),
h('td',
h('h4', String(props.title)),
+ props.series || props.seriesNo ? self.renderSeries(props) : '',
props.authors ?
h('p', h('em', String(props.authors)))
: '',