Updated dataset edit button handlers
This commit is contained in:
parent
5af99d85b5
commit
c633a474b5
@ -96,15 +96,19 @@ $('.test-action').click(function(event) {
|
|||||||
// Edit Dataset Button Handlers
|
// Edit Dataset Button Handlers
|
||||||
$('.edit-question-dataset').click(function(event) {
|
$('.edit-question-dataset').click(function(event) {
|
||||||
|
|
||||||
var filename = $(this).data('filename');
|
var id = $(this).data('id');
|
||||||
var action = $(this).data('action');
|
var action = $(this).data('action');
|
||||||
var disabled = $(this).hasClass('disabled');
|
var disabled = $(this).hasClass('disabled');
|
||||||
|
|
||||||
if ( !disabled ) {
|
if ( !disabled ) {
|
||||||
|
if (action == 'delete') {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: `/admin/settings/questions/${action}/`,
|
url: `/admin/settings/questions/${action}/`,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: JSON.stringify({'filename': filename}),
|
data: JSON.stringify({
|
||||||
|
'id': id,
|
||||||
|
'action': action,
|
||||||
|
}),
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
@ -113,6 +117,11 @@ $('.edit-question-dataset').click(function(event) {
|
|||||||
error_response(response);
|
error_response(response);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
} else if (action == 'edit') {
|
||||||
|
window.location.href = `/admin/editor/${id}/`
|
||||||
|
} else if (action == 'download') {
|
||||||
|
window.location.href = `/admin/settings/questions/download/${id}/`
|
||||||
|
}
|
||||||
};
|
};
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user