Show confirm dialog before deleting problem

This commit is contained in:
James Wang 2016-04-07 23:41:35 -04:00
parent a94df0dd49
commit 765f6e0ec1
No known key found for this signature in database
GPG key ID: 5B80C0B3F263CD5B
2 changed files with 32 additions and 16 deletions

View file

@ -56,6 +56,8 @@ var update_problem = function(form_id) {
}; };
var delete_problem = function(form_id) { var delete_problem = function(form_id) {
$('#confirm').modal("show", { backdrop: 'static', keyboard: false })
.one('click', '#delete', function() {
var input = "#" + form_id + " input"; var input = "#" + form_id + " input";
var pid = form_id.split("_")[1]; var pid = form_id.split("_")[1];
$(input).attr("disabled", "disabled"); $(input).attr("disabled", "disabled");
@ -75,4 +77,6 @@ var delete_problem = function(form_id) {
$(input).removeAttr("disabled"); $(input).removeAttr("disabled");
}); });
}); });
});
} }

View file

@ -73,6 +73,18 @@
</div> </div>
</div> </div>
<div id="confirm" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">Are you sure you want to delete this problem?</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-primary" id="delete">Delete</button>
<button type="button" data-dismiss="modal" class="btn">Cancel</button>
</div>
</div>
</div>
</div>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$(".selectpicker").selectpicker(); $(".selectpicker").selectpicker();