mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: contest: acm: lock scoreboard
This commit is contained in:
1 parent
cb02b8dafe
commit
e67ff511bb
17 files changed
+224
-196
No files matched your search
@@ -27,7 +27,7 @@ class ChangeThemeAction extends EditorAction {
|
||||
super({
|
||||
id: 'hydro.changeEditorTheme',
|
||||
label: i18n('Change Theme'),
|
||||
alias: i18n('Change Theme'),
|
||||
alias: [i18n('Change Theme'), 'Change Theme'],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -663,6 +663,7 @@ Saving file...: 正在保存文件...
|
||||
score canceled: 成绩取消
|
||||
Score: 分数
|
||||
Scoreboard (Hidden): 成绩表 (隐藏)
|
||||
Scoreboard locked at {0}: 比赛已于 {0} 封榜。
|
||||
Scoreboard: 成绩表
|
||||
Scripts: 脚本
|
||||
Search: 搜索
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.30.9",
|
||||
"version": "4.30.10",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
@@ -25,15 +25,15 @@
|
||||
"chalk": "^4.1.2",
|
||||
"classnames": "^2.3.1",
|
||||
"clean-webpack-plugin": "^4.0.0",
|
||||
"clipboard": "^2.0.8",
|
||||
"clipboard": "^2.0.9",
|
||||
"copy-webpack-plugin": "^6.4.1",
|
||||
"css-loader": "^4.3.0",
|
||||
"diff-dom": "^4.2.3",
|
||||
"echarts": "^5.2.2",
|
||||
"echarts": "^5.3.0",
|
||||
"emojis-keywords": "2.0.0",
|
||||
"emojis-list": "2.1.0",
|
||||
"esbuild-loader": "^2.18.0",
|
||||
"eslint": "^8.7.0",
|
||||
"eslint": "^8.8.0",
|
||||
"eslint-config-airbnb": "^18.2.1",
|
||||
"eslint-import-resolver-webpack": "^0.13.2",
|
||||
"eslint-plugin-import": "^2.25.4",
|
||||
@@ -92,7 +92,7 @@
|
||||
"through2": "^4.0.2",
|
||||
"timeago-react": "^3.0.4",
|
||||
"timeago.js": "^4.0.2",
|
||||
"vditor": "^3.8.10",
|
||||
"vditor": "^3.8.11",
|
||||
"vinyl-buffer": "^1.0.1",
|
||||
"web-streams-polyfill": "^3.2.0",
|
||||
"webpack": "^4.46.0",
|
||||
@@ -116,7 +116,7 @@
|
||||
"markdown-it-table-of-contents": "^0.6.0",
|
||||
"mongodb": "^3.7.3",
|
||||
"nunjucks": "^3.2.3",
|
||||
"react-query": "^3.34.8",
|
||||
"react-query": "^3.34.12",
|
||||
"streamsaver": "^2.0.5",
|
||||
"xss": "^1.0.10"
|
||||
}
|
||||
|
||||
@@ -1,65 +1,16 @@
|
||||
import { NamedPage } from 'vj/misc/Page';
|
||||
import code from 'vj/components/highlighter/code-example';
|
||||
import i18n from 'vj/utils/i18n';
|
||||
import tpl from 'vj/utils/tpl';
|
||||
|
||||
const page = new NamedPage('home_preference', async () => {
|
||||
async function mountComponent() {
|
||||
const [{ default: prismjs }, React, { render }] = await Promise.all([
|
||||
import('vj/components/highlighter/prismjs'),
|
||||
import('react'),
|
||||
import('react-dom'),
|
||||
]);
|
||||
const page = new NamedPage('home_preference', () => {
|
||||
function setOptions($el, options) {
|
||||
$el.empty();
|
||||
$.each(options, (key, value) => {
|
||||
$el.append($('<option></option>').attr('value', key).text(value));
|
||||
});
|
||||
}
|
||||
|
||||
class AstylePreview extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { highlight: prismjs.highlight(this.preview, prismjs.Prism.languages.cpp, 'C++') };
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
<div className="medium-4 columns form__item end">
|
||||
<label htmlFor="astyleOptions_input">
|
||||
{i18n('astyleOptions')}
|
||||
<div id="astyleOptions_input" name="form_item_astyleOptions" className="textbox-container">
|
||||
<textarea
|
||||
type="textarea"
|
||||
spellCheck={false}
|
||||
name="astyleOptions"
|
||||
value={this.state.value}
|
||||
style={{ height: '400px' }}
|
||||
onChange={(ev) => {
|
||||
ev.stopPropagation();
|
||||
const highlight = prismjs.highlight(code, prismjs.Prism.languages.cpp, 'C++');
|
||||
this.setState({ value: ev.target.value, highlight });
|
||||
}}
|
||||
className="textbox"
|
||||
/>
|
||||
</div>
|
||||
</label>
|
||||
<p className="help-text">{i18n('astyle formatting options')}</p>
|
||||
</div>
|
||||
<div className="medium-8 columns form__item end">
|
||||
<label htmlFor="astylePreview">
|
||||
{i18n('Preview') /* eslint-disable-next-line */}
|
||||
<pre id="astylePreview" style={{ height: '400px' }}><code dangerouslySetInnerHTML={{ __html: this.state.highlight }}></code></pre>
|
||||
</label>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function setOptions($el, options) {
|
||||
$el.empty();
|
||||
$.each(options, (key, value) => {
|
||||
$el.append($('<option></option>').attr('value', key).text(value));
|
||||
});
|
||||
}
|
||||
|
||||
const $el = $(tpl`\
|
||||
const $el = $(tpl`\
|
||||
<div class="row">
|
||||
<div class="medium-5 columns form__item end">
|
||||
<label>
|
||||
@@ -79,50 +30,42 @@ const page = new NamedPage('home_preference', async () => {
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
$('[name="codeLang"]')
|
||||
.parent().parent().parent()
|
||||
.parent()
|
||||
.hide()
|
||||
.after($el);
|
||||
$('[name="codeLang"]')
|
||||
.parent().parent().parent()
|
||||
.parent()
|
||||
.hide()
|
||||
.after($el);
|
||||
|
||||
function onChangeMain(update = true) {
|
||||
const options = {};
|
||||
for (const key in window.LANGS) {
|
||||
if (key.startsWith(`${this.value}.`) && key !== this.value) options[key] = window.LANGS[key].display;
|
||||
}
|
||||
if (Object.keys(options).length > 1) {
|
||||
setOptions($('#codelang-sub-select'), options);
|
||||
$('#codelang-sub-container').show();
|
||||
if (update) $('[name="codeLang"]').val($('#codelang-sub-select').val());
|
||||
} else {
|
||||
$('#codelang-sub-container').hide();
|
||||
if (update) $('[name="codeLang"]').val(this.value);
|
||||
}
|
||||
}
|
||||
const main = {};
|
||||
function onChangeMain(update = true) {
|
||||
const options = {};
|
||||
for (const key in window.LANGS) {
|
||||
if (!key.includes('.')) main[key] = window.LANGS[key].display;
|
||||
if (key.startsWith(`${this.value}.`) && key !== this.value) options[key] = window.LANGS[key].display;
|
||||
}
|
||||
if (Object.keys(options).length > 1) {
|
||||
setOptions($('#codelang-sub-select'), options);
|
||||
$('#codelang-sub-container').show();
|
||||
if (update) $('[name="codeLang"]').val($('#codelang-sub-select').val());
|
||||
} else {
|
||||
$('#codelang-sub-container').hide();
|
||||
if (update) $('[name="codeLang"]').val(this.value);
|
||||
}
|
||||
setOptions($('#codelang-main-select'), main);
|
||||
const current = $('[name="codeLang"]').val();
|
||||
if (current.includes('.')) {
|
||||
const [m] = current.split('.');
|
||||
$('#codelang-main-select').val(m);
|
||||
onChangeMain.call({ value: m }, false);
|
||||
$('#codelang-sub-select').val(current);
|
||||
} else $('#codelang-main-select').val(current);
|
||||
$('#codelang-main-select').on('change', onChangeMain);
|
||||
$('#codelang-sub-select').on('change', function () {
|
||||
$('[name="codeLang"]').val(this.value);
|
||||
});
|
||||
|
||||
render(
|
||||
<AstylePreview></AstylePreview>,
|
||||
$('[name="form_item_astyleOptions"]').get(0).parentNode.parentNode.parentNode,
|
||||
);
|
||||
}
|
||||
|
||||
mountComponent();
|
||||
const main = {};
|
||||
for (const key in window.LANGS) {
|
||||
if (!key.includes('.')) main[key] = window.LANGS[key].display;
|
||||
}
|
||||
setOptions($('#codelang-main-select'), main);
|
||||
const current = $('[name="codeLang"]').val();
|
||||
if (current.includes('.')) {
|
||||
const [m] = current.split('.');
|
||||
$('#codelang-main-select').val(m);
|
||||
onChangeMain.call({ value: m }, false);
|
||||
$('#codelang-sub-select').val(current);
|
||||
} else $('#codelang-main-select').val(current);
|
||||
$('#codelang-main-select').on('change', onChangeMain);
|
||||
$('#codelang-sub-select').on('change', function () {
|
||||
$('[name="codeLang"]').val(this.value);
|
||||
});
|
||||
});
|
||||
|
||||
export default page;
|
||||
@@ -40,16 +40,6 @@ formatCode:
|
||||
desc: Auto format code
|
||||
category: preference
|
||||
value: true
|
||||
astyleOptions:
|
||||
type: text
|
||||
family: highlight
|
||||
desc: astyle formatting options
|
||||
category: preference
|
||||
value: >
|
||||
style=java attach-namespaces attach-classes attach-inlines attach-extern-c attach-closing-while
|
||||
indent-col1-comments break-blocks pad-oper pad-comma pad-header unpad-paren align-pointer=name
|
||||
break-one-line-headers attach-return-type attach-return-type-decl convert-tabs close-templates
|
||||
max-code-length=110 break-after-logical
|
||||
about:
|
||||
type: markdown
|
||||
name: about
|
||||
|
||||
@@ -92,6 +92,9 @@
|
||||
disabled:not handler.user.hasPerm(perm.PERM_EDIT_PROBLEM),
|
||||
row:false
|
||||
}) }}
|
||||
{% if tdoc.lockAt %}
|
||||
<input type="hidden" name="lock" value="{{ ((tdoc.endAt - tdoc.lockAt)/60000)|int }}">
|
||||
{% endif %}
|
||||
</div>
|
||||
{{ form.form_textarea({
|
||||
columns:null,
|
||||
|
||||
@@ -12,6 +12,13 @@
|
||||
<span class="icon icon-download"></span> {{ _('Export as CSV') }}
|
||||
</a>
|
||||
</div>
|
||||
{% if model.contest.isLocked(tdoc) %}
|
||||
<div class="section__body no-padding">
|
||||
<blockquote class="note">
|
||||
{{ _('Scoreboard locked at {0}').format(datetimeSpan(tdoc.lockAt))|safe }}
|
||||
</blockquote>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="section__body no-padding overflow-hidden-horizontal">
|
||||
<table class="data-table">
|
||||
<colgroup>
|
||||
|
||||
Reference in new issue
Block a user