core&ui: support file renaming (#688)

Co-authored-by: undefined <i@undefined.moe>
This commit is contained in:
Milmonandundefined authored and GitHub committed 2023-11-19 21:46:15 +08:00
1 parent 746efef9bf
commit 01cb6944b7
19 files changed
+496 -144

No files matched your search

@@ -13,7 +13,7 @@
{% if not sidebar %}<col class="col--checkbox">{% endif %}
<col class="col--name">
<col class="col--size">
{% if sidebar %}<col class="col--operation">{% endif %}
{% if can_edit %}<col class="col--operation">{% endif %}
</colgroup>
<thead>
<tr>
@@ -26,7 +26,7 @@
{% endif %}
<th class="col--name">{{ _('Filename') }}</th>
<th class="col--size">{{ _('Size') }}</th>
{% if sidebar %}<th class="col--operation"><span class="icon icon-wrench"></span></th>{% endif %}
{% if can_edit %}<th class="col--operation"><span class="icon icon-wrench"></span></th>{% endif %}
</tr>
</thead>
<tbody>
@@ -47,8 +47,11 @@
{% endif %}
</td>
<td class="col--size">{{ size(file.size) }}</td>
{% if sidebar %}
<td class="col--operation"><a href="javascript:;" name="{{ filetype }}__delete"><span class="icon icon-delete"></span></a></td>
{% if can_edit %}
<td class="col--operation">
<a href="javascript:;" name="{{ filetype }}__rename"><span class="icon icon-edit"></span></a>
<a href="javascript:;" name="{{ filetype }}__delete"><span class="icon icon-delete"></span></a>
</td>
{% endif %}
</tr>
{%- endfor -%}
@@ -29,6 +29,7 @@
<li class="menu__seperator"></li>
</ol>
{% set sidebar = true %}
{% set can_edit = true %}
{% set filetype = "testdata" %}
{% include "partials/problem_files.html" %}
</div>
@@ -107,6 +107,7 @@
</li>
</ol>
{% set sidebar = true %}
{% set can_edit = true %}
{% set filetype = "additional_file" %}
{% include "partials/problem_files.html" %}
</div>
@@ -15,12 +15,14 @@
</div>
{{ noscript_note.render() }}
{% set filetype = "testdata" %}
{% set can_edit = (handler.user.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM)) and not reference %}
{% include "partials/problem_files.html" %}
{% if not reference and (handler.user.own(pdoc) or handler.user.hasPerm(perm.PERM_READ_PROBLEM_DATA) or handler.user.hasPriv(PRIV.PRIV_READ_PROBLEM_DATA)) %}
<div class="section__body">
<button class="rounded button" name="download_selected_testdata">{{ _('Download Selected') }}</button>
{% if handler.user.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<button class="rounded button" name="remove_selected_testdata">{{ _('Remove Selected') }}</button>
<button class="rounded button" name="rename_selected_testdata">{{ _('Rename Selected') }}</button>
{% endif %}
</div>
{% endif %}
@@ -38,11 +40,13 @@
</div>
</div>
{% set filetype = "additional_file" %}
{% set can_edit = (handler.user.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM)) and not reference %}
{% include "partials/problem_files.html" %}
<div class="section__body">
<button class="rounded button" name="download_selected_file">{{ _('Download Selected') }}</button>
{% if (handler.user.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM)) and not reference %}
<button class="rounded button" name="remove_selected_file">{{ _('Remove Selected') }}</button>
<button class="rounded button" name="rename_selected_file">{{ _('Rename Selected') }}</button>
{% endif %}
</div>
</div>