This commit is contained in:
cuom1999 2024-02-23 17:07:49 -06:00
commit 7bba448ef5
5 changed files with 35 additions and 22 deletions

View file

@ -429,26 +429,6 @@ urlpatterns = [
markdown_editor.MarkdownEditor.as_view(), markdown_editor.MarkdownEditor.as_view(),
name="markdown_editor", name="markdown_editor",
), ),
url(
r"^test_formatter/",
include(
[
url(
r"^$", test_formatter.TestFormatter.as_view(), name="test_formatter"
),
url(
r"^edit_page$",
test_formatter.EditTestFormatter.as_view(),
name="edit_page",
),
url(
r"^download_page$",
test_formatter.DownloadTestFormatter.as_view(),
name="download_page",
),
]
),
),
url( url(
r"^submission_source_file/(?P<filename>(\w|\.)+)", r"^submission_source_file/(?P<filename>(\w|\.)+)",
submission.SubmissionSourceFileView.as_view(), submission.SubmissionSourceFileView.as_view(),

View file

@ -25,8 +25,11 @@ def id_to_path(id):
def get_names_in_archive(file_path): def get_names_in_archive(file_path):
suffixes = ("inp", "out", "INP", "OUT")
with ZipFile(os.path.join(settings.MEDIA_ROOT, file_path)) as f: with ZipFile(os.path.join(settings.MEDIA_ROOT, file_path)) as f:
result = [x for x in f.namelist() if not x.endswith("/")] result = [
x for x in f.namelist() if not x.endswith("/") and x.endswith(suffixes)
]
return list(sorted(result, key=tf_utils.natural_sorting_key)) return list(sorted(result, key=tf_utils.natural_sorting_key))

View file

@ -23,6 +23,12 @@
.button { .button {
display:inline-block; display:inline-block;
} }
.copyright {
position: absolute;
bottom: 48px;
left: 50%;
transform: translate(-50%, -50%);
}
</style> </style>
{% endblock %} {% endblock %}
@ -76,6 +82,9 @@
<button type="submit" id="download" class="button">{{_('Download')}}</button> <button type="submit" id="download" class="button">{{_('Download')}}</button>
<a href="{{url('test_formatter_edit')}}?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>
<div class="copyright">
<p >{{_('Copyright')}} Nguyễn Tiến Trung Kiên</p>
</div>
</div> </div>

View file

@ -23,6 +23,12 @@
.preview-container { .preview-container {
padding-bottom: 16px; padding-bottom: 16px;
} }
.copyright {
position: absolute;
bottom: 48px;
left: 50%;
transform: translate(-50%, -50%);
}
#preview { #preview {
background-color: rgb(220, 220, 220); background-color: rgb(220, 220, 220);
border: solid 2px rgb(180, 180, 180); border: solid 2px rgb(180, 180, 180);
@ -127,5 +133,8 @@
<button type="submit" id="convert" class="button">{{_('Convert')}}</button> <button type="submit" id="convert" class="button">{{_('Convert')}}</button>
<button type="submit" id="download" class="button">{{_('Download')}}</button> <button type="submit" id="download" class="button">{{_('Download')}}</button>
</div> </div>
<div class="copyright">
<p >{{_('Copyright')}} Nguyễn Tiến Trung Kiên</p>
</div>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -1,5 +1,14 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block media %}
<style>
.copyright {
position: absolute;
bottom: 48px;
left: 50%;
transform: translate(-50%, -50%);
}
</style>
{% endblock %}
{% block body %} {% block body %}
<center> <center>
<form method="post" enctype="multipart/form-data"> <form method="post" enctype="multipart/form-data">
@ -7,5 +16,8 @@
{{ form }} {{ form }}
<button type="submit" style="margin-top: 2em">{{_('Upload')}}</button> <button type="submit" style="margin-top: 2em">{{_('Upload')}}</button>
</form> </form>
<div class="copyright">
<p >{{_('Copyright')}} Nguyễn Tiến Trung Kiên</p>
</div>
</center> </center>
{% endblock %} {% endblock %}