ui: fix upload

pull/142/head
wuxianucw 3 years ago
parent 18b4f3e33b
commit 16a6787ae7
No known key found for this signature in database
GPG Key ID: 18D12226ABB5368F

@ -52,6 +52,16 @@ AC Message: 通过消息
Accepted Ratio: 通过率
Accepted: 已通过
Access Control: 访问控制
Processing...: 处理中...
Confirm to delete the selected files?: 确认删除所选文件吗?
Selected files have been deleted.: 所选文件已被删除。
You don't have permission to upload file.: 您没有权限上传文件。
file too large: 文件过大
Loading file...: 正在加载文件内容...
Loading editor...: 正在加载编辑器...
Saving file...: 正在保存文件...
File saved.: 文件已成功保存。
Please select at least one file to perform this operation.: 请选择至少一个文件来执行此操作。
Account Settings: 账户设置
Action: 动作
Active Sessions: 活动会话

@ -88,12 +88,12 @@ const page = new NamedPage('problem_files', () => {
Notification.info(i18n('Uploading files...'));
window.addEventListener('beforeunload', onBeforeUnload);
const dialog = new Dialog({
$body: `\
<div class="file-label" style="text-align: center;margin: 5px 0;color: gray;font-size: small;"></div>
$body: `
<div class="file-label" style="text-align: center; margin-bottom: 5px; color: gray; font-size: small;"></div>
<div class="bp3-progress-bar bp3-intent-primary bp3-no-stripes">
<div class="file-progress bp3-progress-meter" style="width: 0"></div>
</div>
<div class="upload-label" style="text-align: center;margin-bottom: 8px;color: gray;"></div>
<div class="upload-label" style="text-align: center; margin: 5px 0; color: gray; font-size: small;"></div>
<div class="bp3-progress-bar bp3-intent-primary bp3-no-stripes">
<div class="upload-progress bp3-progress-meter" style="width: 0"></div>
</div>`,
@ -185,11 +185,11 @@ const page = new NamedPage('problem_files', () => {
* @param {JQuery.DropEvent<HTMLElement, undefined, HTMLElement, HTMLElement>} ev
*/
function handleDrop(type, ev) {
if (!$('[name="remove_selected_testdata"]').length) {
ev.preventDefault();
if (!$('[name="upload_testdata"]').length) {
Notification.error(i18n("You don't have permission to upload file."));
return;
}
ev.preventDefault();
ev = ev.originalEvent;
const files = [];
if (ev.dataTransfer.items) {
@ -261,7 +261,7 @@ const page = new NamedPage('problem_files', () => {
await pjax.request({ push: false });
}
if ($('[name="remove_selected_testdata"]').length) {
if ($('[name="upload_testdata"]').length) {
$('.problem-files-testdata .col--name').on('click', (ev) => handleEdit('testdata', ev));
$('.problem-files-additional_file .col--name').on('click', (ev) => handleEdit('additional_file', ev));
$('[name="upload_testdata"]').on('click', () => handleClickUpload('testdata'));

@ -186,9 +186,9 @@ async function handleOperation(operation) {
if (operation === 'delete') {
const action = await new ConfirmDialog({
$body: tpl`
<div class="typo">
<p>${i18n('Confirm to delete the selected problems?')}</p>
</div>`,
<div class="typo">
<p>${i18n('Confirm to delete the selected problems?')}</p>
</div>`,
}).open();
if (action !== 'yes') return;
}

Loading…
Cancel
Save