git ssb

0+

ev / gitmx



Commit ae35d4b398efe8352b6b31fd5853d40aa9009cfc

render buttons on git messages, render stars on mini messages

Ev Bogue committed on 2/13/2019, 4:59:00 AM
Parent: 4ebd64c079e0384a0b21f1f89f9cfc9606bd7d13

Files changed

tools.jschanged
tools.jsView
@@ -8,8 +8,64 @@
88 var config = require('./config')()
99 var id = require('./keys').id
1010
1111
12 +module.exports.getLabels = function (msg) {
13 +
14 + var labelsDiv = h('div')
15 +
16 + pull(
17 + sbot.query({query: [{$filter: {value: { content: {type: 'label', link: msg.key}}}}], limit: 100, live: true}),
18 + pull.drain(function (labels){
19 + console.log(labels)
20 + if (labels.value){
21 + labelsDiv.appendChild(h('span', ' ', h('mark', h('a', {href: '#label/' + labels.value.content.label}, labels.value.content.label))))
22 +
23 + }
24 + })
25 + )
26 +
27 + return labelsDiv
28 +}
29 +
30 +module.exports.labeler = function (msg) {
31 + var labelSpan = h('span')
32 +
33 + var inputter = h('input.labels', {placeholder: 'your-label'})
34 +
35 + var labeler = h('div',
36 + inputter,
37 + h('button.btn', 'Publish label', {
38 + onclick: function () {
39 + var post = {}
40 + post.type = 'label',
41 + post.label = inputter.value,
42 + post.link = msg.key
43 +
44 + sbot.publish(post, function (err, msg){
45 + console.log(msg)
46 + labeler.parentNode.replaceChild(labelSpan, labeler)
47 + })
48 + }
49 + }),
50 + h('button.btn', 'Cancel', {
51 + onclick: function () {
52 + labeler.parentNode.replaceChild(labelSpan, labeler)
53 + }
54 + })
55 + )
56 +
57 + var labels = h('button.btn', 'Add label', {
58 + onclick: function () {
59 + labelSpan.parentNode.replaceChild(labeler, labelSpan)
60 + }
61 + })
62 +
63 + labelSpan.appendChild(labels)
64 +
65 + return labelSpan
66 +}
67 +
1268 module.exports.queueButton = function (src) {
1369 var queueButton = h('span.queue:' + src.key.substring(0,44))
1470
1571 var addToQueue = h('button.btn.right', 'Queue', {
@@ -304,8 +360,9 @@
304360
305361
306362 mini.appendChild(h('span', content))
307363 mini.appendChild(exports.timestamp(msg))
364 + mini.appendChild(votes(msg))
308365
309366 if (msg.value.content.recps) {
310367 mini.appendChild(lock)
311368 }

Built with git-ssb-web