mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: add new features about domain (#528)
Co-authored-by: undefined <i@undefined.moe> - Add navigation hint - Update homework/contest filter by assign - Allow empty query for DomainSelectAutoComplete
This commit is contained in:
1 parent
9fb85300e7
commit
3581ccb065
12 files changed
+129
-35
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import $ from 'jquery';
|
||||
import _ from 'lodash';
|
||||
import DomainSelectAutoComplete from 'vj/components/autocomplete/DomainSelectAutoComplete';
|
||||
import { ActionDialog, ConfirmDialog } from 'vj/components/dialog';
|
||||
import Dropdown from 'vj/components/dropdown/Dropdown';
|
||||
import createHint from 'vj/components/hint';
|
||||
@@ -176,19 +177,35 @@ async function handleOperation(operation) {
|
||||
}).open();
|
||||
if (action !== 'yes') return;
|
||||
} else if (operation === 'copy') {
|
||||
const action = await new ActionDialog({
|
||||
$body: tpl`
|
||||
<div class="typo">
|
||||
<label>
|
||||
${i18n('Target')}
|
||||
<div class="textbox-container">
|
||||
<input name="target" type="text" class="textbox" data-autofocus>
|
||||
</div>
|
||||
</label>
|
||||
$(tpl`
|
||||
<div style="display: none" class="dialog__body--problem-copy">
|
||||
<div class="row"><div class="columns">
|
||||
<h1 name="select_user_hint">${i18n('Copy Problems')}</h1>
|
||||
</div></div>
|
||||
<div class="row">
|
||||
<div class="columns">
|
||||
<label>
|
||||
${i18n('Target')}
|
||||
<div class="textbox-container">
|
||||
<input name="target" type="text" class="textbox" data-autofocus>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
</div>
|
||||
`).appendTo(document.body);
|
||||
const domainSelector = DomainSelectAutoComplete.getOrConstruct($('.dialog__body--problem-copy [name="target"]'));
|
||||
const copyDialog = await new ActionDialog({
|
||||
$body: $('.dialog__body--problem-copy > div'),
|
||||
onDispatch(action) {
|
||||
if (action === 'ok' && domainSelector.value() === null) {
|
||||
domainSelector.focus();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
}).open();
|
||||
if (action !== 'ok') return;
|
||||
if (copyDialog !== 'ok') return;
|
||||
const target = $('[name="target"]').val();
|
||||
if (!target) return;
|
||||
payload.target = target;
|
||||
|
||||
Reference in new issue
Block a user