debian-mirror-gitlab/app/assets/javascripts/confirm_danger_modal.js.coffee

21 lines
644 B
CoffeeScript
Raw Normal View History

2015-04-26 12:48:37 +05:30
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()
2015-09-11 14:41:01 +05:30
$('.js-confirm-danger-input').off 'input'
2015-04-26 12:48:37 +05:30
$('.js-confirm-danger-input').on 'input', ->
if rstrip($(@).val()) is project_path
submit.enable()
else
submit.disable()
2015-09-11 14:41:01 +05:30
$('.js-confirm-danger-submit').off 'click'
2015-04-26 12:48:37 +05:30
$('.js-confirm-danger-submit').on 'click', =>
@form.submit()