Added analysis button and scripting
This commit is contained in:
@ -110,6 +110,27 @@ function parse_data(data) {
|
||||
}
|
||||
}
|
||||
|
||||
// Analyse Button
|
||||
$('.dataset-analyse').click(function(event) {
|
||||
|
||||
let id = $(this).data('id')
|
||||
|
||||
$.ajax({
|
||||
url: `/admin/analysis/`,
|
||||
type: 'POST',
|
||||
data: JSON.stringify({'id': id, 'class': 'dataset'}),
|
||||
contentType: 'application/json',
|
||||
success: function(response) {
|
||||
window.location.href = response
|
||||
},
|
||||
error: function(response){
|
||||
error_response(response)
|
||||
},
|
||||
})
|
||||
|
||||
event.preventDefault()
|
||||
})
|
||||
|
||||
// Fetch data once page finishes loading
|
||||
$(window).on('load', function() {
|
||||
$.ajax({
|
||||
|
@ -100,7 +100,18 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-center">
|
||||
<a
|
||||
href="#"
|
||||
class="btn btn-success dataset-analyse {% if not dataset.entries %} disabled {% endif %}"
|
||||
data-id="{{dataset.id}}"
|
||||
title="Analyse Answers"
|
||||
data-action="analyse"
|
||||
>
|
||||
<i class="bi bi-search button-icon"></i>
|
||||
Analyse Answers
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
Reference in New Issue
Block a user