gitlab-org--gitlab-foss/app/assets/javascripts/confirm_danger_modal.js
José Iván b1b51b774b Cleaned up global namespace JS
Moved most of the functions that contained "window.doSomething" that were located at:
- app/assets/javascripts/application.js
To the following file:
- app/assets/javascripts/lib/utils/common_utils.js

The functions listed here:
- window.ajaxGet
- window.split
- window.extractLast
- window.rstrip
- window.disableButtonIfEmptyField
- window.disableButtonIfAnyEmptyField
- window.sanitize
- window.unbindEvents
- window.shiftWindow

Now will be accessible from the "gl.utils" namespace
2016-11-03 23:00:21 -05:00

33 lines
1,004 B
JavaScript

/* eslint-disable */
(function() {
this.ConfirmDangerModal = (function() {
function ConfirmDangerModal(form, text) {
var project_path, submit;
this.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', function() {
if (gl.utils.rstrip($(this).val()) === project_path) {
return submit.enable();
} else {
return submit.disable();
}
});
$('.js-confirm-danger-submit').off('click');
$('.js-confirm-danger-submit').on('click', (function(_this) {
return function() {
return _this.form.submit();
};
})(this));
}
return ConfirmDangerModal;
})();
}).call(this);