Lines 1-16
Link Here
|
1 |
$(document).ready(function() { |
1 |
$(document).ready(function() { |
2 |
|
2 |
|
3 |
let urlParams = new URLSearchParams(window.location.search); |
3 |
let urlParams = new URLSearchParams(window.location.search); |
4 |
if ( urlParams.has('modal') ) { |
4 |
if (urlParams.has('modal')) { |
5 |
let modal = urlParams.get('modal'); |
5 |
let modal = urlParams.get('modal'); |
6 |
if ( modal == 'concern' ) { |
6 |
if (modal == 'concern') { |
7 |
$("#addConcernModal").modal('show'); |
7 |
$("#addConcernModal").modal('show'); |
8 |
} |
8 |
} |
9 |
} |
9 |
} |
10 |
|
10 |
|
11 |
$('#addConcernModal').on('show.bs.modal', function (e) { |
11 |
$('#addConcernModal').on('show.bs.modal', function(e) { |
12 |
if ( logged_in_user_id === "" ) { |
12 |
$('#addConfirm').prop('disabled', false); |
13 |
$('#modalAuth').append('<input type="hidden" name="return" value="'+window.location+'&modal=concern" />'); |
13 |
if (logged_in_user_id === "") { |
|
|
14 |
$('#modalAuth').append('<input type="hidden" name="return" value="' + window.location + '&modal=concern" />'); |
14 |
$('#loginModal').modal('show'); |
15 |
$('#loginModal').modal('show'); |
15 |
return false; |
16 |
return false; |
16 |
} |
17 |
} |
Lines 29-41
$(document).ready(function() {
Link Here
|
29 |
reporter_id: reporter_id, |
30 |
reporter_id: reporter_id, |
30 |
}; |
31 |
}; |
31 |
|
32 |
|
|
|
33 |
$('#concern-submit-spinner').show(); |
34 |
$('#addConfirm').prop('disabled', true); |
32 |
$.ajax({ |
35 |
$.ajax({ |
33 |
url: '/api/v1/public/tickets', |
36 |
url: '/api/v1/public/tickets', |
34 |
type: 'POST', |
37 |
type: 'POST', |
35 |
data: JSON.stringify(params), |
38 |
data: JSON.stringify(params), |
36 |
success: function(data) { |
39 |
success: function(data) { |
|
|
40 |
$('#concern-submit-spinner').hide(); |
37 |
$('#addConcernModal').modal('hide'); |
41 |
$('#addConcernModal').modal('hide'); |
38 |
$('#concern_body').val(''); |
42 |
$('#concern_body').val(''); |
|
|
43 |
$('#concern_title').val(''); |
44 |
$('h1:first').before('<div class="alert alert-success">Your concern was sucessfully submitted.</div>'); |
45 |
}, |
46 |
error: function(data) { |
47 |
$('#concern-submit-spinner').hide(); |
48 |
$('#addConcernModal').modal('hide'); |
49 |
$('h1:first').before('<div class="alert alert-error">There was an error when submitting your concern, please contact a librarian.</div>'); |
39 |
}, |
50 |
}, |
40 |
contentType: "json" |
51 |
contentType: "json" |
41 |
}); |
52 |
}); |
42 |
- |
|
|