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,4 +1,5 @@
|
||||
import $ from 'jquery';
|
||||
import DomainSelectAutoComplete from 'vj/components/autocomplete/DomainSelectAutoComplete';
|
||||
import { ActionDialog, ConfirmDialog } from 'vj/components/dialog';
|
||||
import Notification from 'vj/components/notification';
|
||||
import { NamedPage } from 'vj/misc/Page';
|
||||
@@ -22,17 +23,31 @@ const page = new NamedPage([
|
||||
});
|
||||
});
|
||||
$(document).on('click', '[name="problem-sidebar__copy"]', () => {
|
||||
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 Problem')}</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"]')) as any;
|
||||
new ActionDialog({
|
||||
$body: $('.dialog__body--problem-copy > div'),
|
||||
onDispatch(action) {
|
||||
if (action === 'ok' && domainSelector.value() === null) {
|
||||
domainSelector.focus();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
}).open().then(async (action) => {
|
||||
if (action !== 'ok') return;
|
||||
const target = $('[name="target"]').val();
|
||||
|
||||
Reference in new issue
Block a user