|
|
|
|
@ -73,15 +73,30 @@ export default class extends ApplicationController {
|
|
|
|
|
type: 'PUT', |
|
|
|
|
data: params, |
|
|
|
|
success: function() { |
|
|
|
|
$(".btn-close-x").trigger("click") |
|
|
|
|
$('.toast').addClass('bg-success').show() |
|
|
|
|
$( ".toast-body" ).html( "<span><b>Submitted Successfully</b></span>" ), |
|
|
|
|
location.pathname = "/documents/" + document_id + "/doctrines/" + doctrine_id |
|
|
|
|
}, |
|
|
|
|
error: function() {
|
|
|
|
|
$(".btn-close-x").trigger("click"), |
|
|
|
|
$('.toast').addClass('bg-danger').show(), |
|
|
|
|
$( ".toast-body" ).html( "<span><b>Unexpected Error Problem Occurred</b></span>" ) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
$.post("/api/doctrines", $.extend({ jurisprudence_ids: [document_id] }, params), function(data, status) { |
|
|
|
|
if(status === 'success') { |
|
|
|
|
$(".btn-close-x").trigger("click") |
|
|
|
|
$('.toast').addClass('bg-success').show() |
|
|
|
|
$( ".toast-body" ).html( "<span><b>Submitted Successfully</b></span>" ), |
|
|
|
|
location.pathname = "/documents/" + document_id + "/doctrines/" + data.id |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
},
|
|
|
|
|
$(".btn-close-x").trigger("click"), |
|
|
|
|
$('.toast').addClass('bg-danger').show(), |
|
|
|
|
$( ".toast-body" ).html( "<span><b>Unexpected Error Problem Occurred</b></span>" ) |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -97,6 +112,8 @@ export default class extends ApplicationController {
|
|
|
|
|
type: 'DELETE', |
|
|
|
|
success: function() { |
|
|
|
|
location.pathname = "/documents/" + document_id |
|
|
|
|
$('.toast').addClass('bg-danger').show() |
|
|
|
|
$( ".toast-body" ).html( "<span><b>Deleted Successfully</b></span>" ); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|