git ssb

3+

arj / patchbook



Commit ec7448dccb86df89b1a13d4732f13d1e5ecac1f6

Styling and functional fixes to details

Anders Rune Jensen committed on 11/4/2017, 11:50:54 PM
Parent: 4bac9611e8db1259ebe4ba03ad559b2a9d28421f

Files changed

book/html/layout/detail.jschanged
book/html/layout/detail.mcsschanged
book/html/layout/detail.jsView
@@ -1,13 +1,15 @@
11 const nest = require('depnest')
22 const { h, when, computed, Value } = require('mutant')
33 var htmlEscape = require('html-escape')
4 +const addSuggest = require('suggest-box')
45
56 exports.needs = nest({
67 'book.obs.book': 'first',
78 'about.html.image': 'first',
89 'about.obs.name': 'first',
910 'keys.sync.id': 'first',
11 + 'emoji.async.suggest': 'first',
1012 'emoji.sync.url': 'first',
1113 'message.html': {
1214 'markdown': 'first'
1315 },
@@ -42,13 +44,31 @@
4244 else
4345 return text
4446 }
4547
46- function valueEdit(isEditing, value) {
48 + function ratingEdit(isEditing, value) {
4749 return when(isEditing,
48- h('input', {'ev-input': e => value.set(e.target.value), value: value }),
49- h('span', { innerHTML: computed(value, simpleMarkdown) }))
50 + h('input', {'ev-input': e => value.set(e.target.value), value: value,
51 + placeholder: 'your rating' }),
52 + h('span.text', { innerHTML: computed(value, simpleMarkdown) }))
53 + }
5054
55 + function ratingTypeEdit(isEditing, value) {
56 + let getEmojiSuggestions = api.emoji.async.suggest()
57 +
58 + let ratingTypeInput = h('input', {'ev-input': e => value.set(e.target.value),
59 + value: value, placeholder: 'rating type' })
60 +
61 + let suggestWrapper = h('span.ratingType', ratingTypeInput)
62 +
63 + addSuggest(ratingTypeInput, (inputText, cb) => {
64 + if (inputText[0] === ':') {
65 + cb(null, getEmojiSuggestions(inputText.slice(1)))
66 + }
67 + }, {cls: 'PatchSuggest'})
68 +
69 + return when(isEditing, suggestWrapper,
70 + h('span.text', { innerHTML: computed(value, simpleMarkdown) }))
5171 }
5272
5373 function simpleEdit(isEditing, name, value) {
5474 return h('div', { classList: when(computed([value, isEditing], (v, e) => { return v || e }),
@@ -105,11 +125,11 @@
105125 reviews.push([
106126 h('section', [api.about.html.image(user),
107127 when(computed([subjective.rating, isEditingSubjective],
108128 (v, e) => { return v || e }),
109- h('span', [api.about.obs.name(user), ' rated '])),
110- valueEdit(isOwnEditingSubj, subjective.rating),
111- valueEdit(isOwnEditingSubj, subjective.ratingType)]),
129 + h('span.text', [api.about.obs.name(user), ' rated '])),
130 + ratingEdit(isOwnEditingSubj, subjective.rating),
131 + ratingTypeEdit(isOwnEditingSubj, subjective.ratingType)]),
112132 simpleEdit(isOwnEditingSubj, 'Shelve', subjective.shelve),
113133 simpleEdit(isOwnEditingSubj, 'Genre', subjective.genre),
114134 textEdit(isOwnEditingSubj, 'Review', subjective.review)
115135 ])
book/html/layout/detail.mcssView
@@ -3,11 +3,18 @@
33
44 section.title, section.authors {
55 input {
66 border: 1px solid gainsboro
7 + height: 1.3rem
8 + padding: 5px
79 }
810 }
911
12 + section.title input {
13 + height: 2rem
14 + margin-bottom: 5px
15 + }
16 +
1017 section.subjective {
1118 div {
1219 -contracted {
1320 display: none
@@ -18,8 +25,12 @@
1825 }
1926
2027 input {
2128 border: 1px solid gainsboro
29 + height: 1.3rem
30 + margin-left: 5px
31 + margin-bottom: 5px
32 + padding: 5px
2233 }
2334
2435 textarea {
2536 border: 1px solid gainsboro
@@ -28,22 +39,27 @@
2839 }
2940 }
3041
3142 section {
43 + margin-top: 5px
3244 line-height: 2rem
3345
34- input {
46 + input, span.ratingType input {
3547 border: 1px solid gainsboro
36- width: 75px
48 + width: 80px
49 + height: 1.3rem
50 + margin-left: 5px
51 + padding: 5px
52 + vertical-align: text-bottom
3753 }
3854
3955 img.Avatar {
4056 width: 2rem;
4157 height: 2rem;
4258 margin-right: 0.5rem
4359 }
4460
45- span {
61 + span.text {
4662 vertical-align: text-bottom
4763
4864 img.emoji {
4965 height: 1.2em;

Built with git-ssb-web