Small changes to test_formatter

This commit is contained in:
cuom1999 2024-01-08 13:06:18 -06:00
parent d7080a4d1b
commit 2b84d62260
4 changed files with 14 additions and 15 deletions

View file

@ -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",
),
]
),

View file

@ -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 @@
</div>
<div class="button-container">
<button type="submit" id="download" class="button">{{_('Download')}}</button>
<a href="{{url('edit_page')}}?file_path={{file_path_getnames}}" id="edit" class="button">{{_('Edit')}}</a>
<a href="{{url('test_formatter_edit')}}?file_path={{file_path_getnames}}" id="edit" class="button">{{_('Edit')}}</a>
</div>
</div>

View file

@ -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);

View file

@ -1,11 +1,11 @@
{% extends 'base.html' %}
{% block body %}
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form }}
<button type="submit">{{_('Upload')}}</button>
</form>
<center>
<form method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form }}
<button type="submit" style="margin-top: 2em">{{_('Upload')}}</button>
</form>
</center>
{% endblock %}