From 2b84d6226076e7a672de286936126ff5dd63a765 Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Mon, 8 Jan 2024 13:06:18 -0600 Subject: [PATCH] Small changes to test_formatter --- dmoj/urls.py | 4 ++-- .../test_formatter/download_test_formatter.html | 4 ++-- templates/test_formatter/edit_test_formatter.html | 7 +++---- templates/test_formatter/test_formatter.html | 14 +++++++------- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/dmoj/urls.py b/dmoj/urls.py index 2b2c52f..d9233de 100644 --- a/dmoj/urls.py +++ b/dmoj/urls.py @@ -420,12 +420,12 @@ urlpatterns = [ url( r"^edit_page$", test_formatter.EditTestFormatter.as_view(), - name="edit_page", + name="test_formatter_edit", ), url( r"^download_page$", test_formatter.DownloadTestFormatter.as_view(), - name="download_page", + name="test_formatter_download", ), ] ), diff --git a/templates/test_formatter/download_test_formatter.html b/templates/test_formatter/download_test_formatter.html index b7f4d2c..2fddc4e 100644 --- a/templates/test_formatter/download_test_formatter.html +++ b/templates/test_formatter/download_test_formatter.html @@ -33,7 +33,7 @@ event.preventDefault() var file_path = document.getElementById('file_path').value; $.ajax({ - url: "{{url('download_page')}}", + url: "{{url('test_formatter_download')}}", type: 'POST', data: { file_path: file_path @@ -74,7 +74,7 @@
- {{_('Edit')}} + {{_('Edit')}}
diff --git a/templates/test_formatter/edit_test_formatter.html b/templates/test_formatter/edit_test_formatter.html index ac4e6f1..6cf7298 100644 --- a/templates/test_formatter/edit_test_formatter.html +++ b/templates/test_formatter/edit_test_formatter.html @@ -45,7 +45,7 @@ $("#convert").on("click", function(event) { event.preventDefault() $.ajax({ - url: "{{url('edit_page')}}", + url: "{{url('test_formatter_edit')}}", type: 'POST', data: { action: 'convert', @@ -70,16 +70,15 @@ $(document).ready(function(){ $("#download").on("click", function(event) { event.preventDefault() - window.location.href = "{{url('edit_page')}}"; $.ajax({ - url: "{{url('edit_page')}}", + url: "{{url('test_formatter_edit')}}", type: 'POST', data: { action: 'download' }, success: function(data) { var file_path = data; - window.location.href = "{{url('download_page')}}" + "?file_path="+file_path; + window.location.href = "{{url('test_formatter_download')}}" + "?file_path="+file_path; }, error: function(error) { alert(error); diff --git a/templates/test_formatter/test_formatter.html b/templates/test_formatter/test_formatter.html index 3d199cb..5831f1d 100644 --- a/templates/test_formatter/test_formatter.html +++ b/templates/test_formatter/test_formatter.html @@ -1,11 +1,11 @@ {% extends 'base.html' %} {% block body %} -
- {% csrf_token %} - {{ form }} - -
- - +
+
+ {% csrf_token %} + {{ form }} + +
+
{% endblock %}