git ssb

0+

ev / gitmx



Commit afc9955231b5cf72a19ab39b8e1fba3713fdf6ac

add issue button and fix errors

Ev Bogue committed on 2/13/2019, 4:36:05 PM
Parent: ae35d4b398efe8352b6b31fd5853d40aa9009cfc

Files changed

render.jschanged
tools.jschanged
views.jschanged
render.jsView
@@ -144,10 +144,10 @@
144144 }
145145
146146 message.appendChild(commits)
147147
148 + var buttons = h('div.buttons')
148149
149- var buttons = h('div.buttons')
150150 buttons.appendChild(tools.star(msg))
151151 buttons.appendChild(tools.labeler(msg))
152152 message.appendChild(tools.getLabels(msg))
153153 message.appendChild(buttons)
@@ -155,9 +155,8 @@
155155 return message
156156
157157 }
158158 else if (msg.value.content.type == 'git-repo') {
159-
160159 var reponame = h('span', ' created a git-ssb repo ', h('a', {href: '#' + msg.key}, msg.key))
161160
162161 message.appendChild(tools.mini(msg, reponame))
163162
@@ -169,10 +168,39 @@
169168
170169 var cloneurl = h('pre', 'git clone ssb://' + msg.key)
171170 message.appendChild(cloneurl)
172171
172 + var name = avatar.name(msg.value.author)
173 +
173174 var buttons = h('div.buttons')
174175
176 + var opts = {}
177 + var fallback = {}
178 +
179 + if (msg.value.content.root)
180 + opts.root = msg.value.content.root
181 + else
182 + opts.root = msg.key
183 +
184 + buttons.appendChild(h('button.btn', 'New issue', {
185 + onclick: function () {
186 + opts.type = 'post'
187 + opts.branch = msg.key
188 + opts.mentions = '[' + name.textContent + '](' + msg.value.author + ')'
189 + if (msg.value.content.recps) {
190 + opts.recps = msg.value.content.recps
191 + }
192 + var r = message.childNodes.length - 1
193 + delete opts.updated
194 + delete opts.original
195 + delete fallback.messageText
196 + fallback.buttons = message.childNodes[r]
197 + var compose = h('div.message#re:' + msg.key.substring(0, 44), composer(opts, fallback))
198 + message.removeChild(message.childNodes[r])
199 + message.parentNode.insertBefore(compose, message.nextSibling)
200 + }
201 + }))
202 +
175203 buttons.appendChild(tools.star(msg))
176204 buttons.appendChild(tools.labeler(msg))
177205 message.appendChild(tools.getLabels(msg))
178206
tools.jsView
@@ -15,12 +15,10 @@
1515
1616 pull(
1717 sbot.query({query: [{$filter: {value: { content: {type: 'label', link: msg.key}}}}], limit: 100, live: true}),
1818 pull.drain(function (labels){
19- console.log(labels)
2019 if (labels.value){
2120 labelsDiv.appendChild(h('span', ' ', h('mark', h('a', {href: '#label/' + labels.value.content.label}, labels.value.content.label))))
22-
2321 }
2422 })
2523 )
2624
@@ -41,9 +39,8 @@
4139 post.label = inputter.value,
4240 post.link = msg.key
4341
4442 sbot.publish(post, function (err, msg){
45- console.log(msg)
4643 labeler.parentNode.replaceChild(labelSpan, labeler)
4744 })
4845 }
4946 }),
views.jsView
@@ -27,9 +27,9 @@
2727 var labelStream = function (label){
2828 var content = h('div.content')
2929 var screen = document.getElementById('screen')
3030 screen.appendChild(hyperscroll(content))
31- content.appendChild(h('div.breadcrumbs.message', h('a', {href: '/'}, 'label'), ' ⯈ ' , h('a', {href: '/#label/' + label}, label)))
31 + content.appendChild(h('div.breadcrumbs.message', h('a', {href: '/'}, 'label'), ' // ' , h('a', {href: '/#label/' + label}, label)))
3232 function createStream (opts) {
3333 return pull(
3434 Next(sbot.query, opts, ['value', 'timestamp']),
3535 pull.map(function (msg){
@@ -400,19 +400,20 @@
400400 var message = h('div.message', 'Missing message!')
401401 content.appendChild(message)
402402 }
403403 if (data) {
404- data.value = data
405- data.key = src
406- console.log(data)
407- var rootMsg = render(data)
404 + var message = {}
405 + message.value = data
406 + message.key = src
407 + console.log(message)
408 + var rootMsg = render(message)
408409
409410 if (content.firstChild) {
410411 content.insertBefore(rootMsg, content.firstChild)
411412 } else {
412413 content.appendChild(rootMsg)
413414 }
414- if (data.value.content.type == 'git-repo') {
415 + if (message.value.content.type == 'git-repo') {
415416 pull(
416417 sbot.backlinks({query: [{$filter: {value: {content: {type: 'git-update'}}, dest: src}}]}),
417418 pull.drain(function (msg) {
418419 if (msg.value) {

Built with git-ssb-web