6fb1e80a26
Multiple event handlers were firing, causing multiple form submissions. Closes #1448 and #1128
20 lines
644 B
CoffeeScript
20 lines
644 B
CoffeeScript
class @ConfirmDangerModal
|
|
constructor: (form, text) ->
|
|
@form = form
|
|
$('.js-confirm-text').text(text || '')
|
|
$('.js-confirm-danger-input').val('')
|
|
$('#modal-confirm-danger').modal('show')
|
|
project_path = $('.js-confirm-danger-match').text()
|
|
submit = $('.js-confirm-danger-submit')
|
|
submit.disable()
|
|
|
|
$('.js-confirm-danger-input').off 'input'
|
|
$('.js-confirm-danger-input').on 'input', ->
|
|
if rstrip($(@).val()) is project_path
|
|
submit.enable()
|
|
else
|
|
submit.disable()
|
|
|
|
$('.js-confirm-danger-submit').off 'click'
|
|
$('.js-confirm-danger-submit').on 'click', =>
|
|
@form.submit()
|