Updated dataset edit button handlers
This commit is contained in:
parent
5af99d85b5
commit
c633a474b5
@ -96,23 +96,32 @@ $('.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 ) {
|
||||||
$.ajax({
|
if (action == 'delete') {
|
||||||
url: `/admin/settings/questions/${action}/`,
|
$.ajax({
|
||||||
type: 'POST',
|
url: `/admin/settings/questions/${action}/`,
|
||||||
data: JSON.stringify({'filename': filename}),
|
type: 'POST',
|
||||||
contentType: 'application/json',
|
data: JSON.stringify({
|
||||||
success: function(response) {
|
'id': id,
|
||||||
window.location.reload();
|
'action': action,
|
||||||
},
|
}),
|
||||||
error: function(response){
|
contentType: 'application/json',
|
||||||
error_response(response);
|
success: function(response) {
|
||||||
},
|
window.location.reload();
|
||||||
});
|
},
|
||||||
|
error: function(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