diff --git a/ref-test/app/admin/static/js/script.js b/ref-test/app/admin/static/js/script.js index 96004f9..1fd1391 100644 --- a/ref-test/app/admin/static/js/script.js +++ b/ref-test/app/admin/static/js/script.js @@ -96,23 +96,32 @@ $('.test-action').click(function(event) { // Edit Dataset Button Handlers $('.edit-question-dataset').click(function(event) { - var filename = $(this).data('filename'); + var id = $(this).data('id'); var action = $(this).data('action'); var disabled = $(this).hasClass('disabled'); if ( !disabled ) { - $.ajax({ - url: `/admin/settings/questions/${action}/`, - type: 'POST', - data: JSON.stringify({'filename': filename}), - contentType: 'application/json', - success: function(response) { - window.location.reload(); - }, - error: function(response){ - error_response(response); - }, - }); + if (action == 'delete') { + $.ajax({ + url: `/admin/settings/questions/${action}/`, + type: 'POST', + data: JSON.stringify({ + 'id': id, + 'action': action, + }), + contentType: 'application/json', + 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(); });