git ssb

0+

ev / microbay



forked from Dominic / patchbay

Commit 4297a42a6a9727bda3d92f59855d0b7efa361c28

Disable publish button while publish is in progess

Charles Lehner committed on 8/1/2016, 10:48:36 PM
Parent: 7e6b652a5696469876bec17b9d29a4e649627d76

Files changed

modules/compose.jschanged
modules/compose.jsView
@@ -48,8 +48,9 @@
4848
4949 var files = []
5050
5151 function publish() {
52+ publishBtn.disabled = true
5253 var content
5354 try {
5455 content = JSON.parse(ta.value)
5556 } catch (err) {
@@ -57,23 +58,26 @@
5758 meta.mentions = mentions(ta.value).concat(files)
5859 try {
5960 meta = prepublish(meta)
6061 } catch (err) {
62+ publishBtn.disabled = false
6163 return alert(err.message)
6264 }
6365 return message_confirm(meta, done)
6466 }
6567 message_confirm(content, done)
6668
6769 function done (err, msg) {
70+ publishBtn.disabled = false
6871 if(err) return alert(err.stack)
6972 else ta.value = ''
7073
7174 if (cb) cb(err, msg)
7275 }
7376 }
7477
7578
79+ var publishBtn = h('button', 'Publish', {onclick: publish})
7680 var composer =
7781 h('div.compose', h('div.column', ta,
7882 accessories = h('div.row.compose__controls',
7983 //hidden until you focus the textarea
@@ -84,9 +88,9 @@
8488 var embed = file.type.indexOf('image/') === 0 ? '!' : ''
8589 ta.value += embed + '['+file.name+']('+file.link+')'
8690 console.log('added:', file)
8791 }),
88- h('button', 'Publish', {onclick: publish}))
92+ publishBtn)
8993 )
9094 )
9195
9296 suggest(ta, function (word, cb) {

Built with git-ssb-web