mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
feat::
core: buildContent: sv for samples core&ui: record_main: filter_by_status ui: scoreboard: colorize
This commit is contained in:
1 parent
b0cf638616
commit
7d7d3c1599
14 files changed
+69
-38
No files matched your search
@@ -7,6 +7,7 @@ const { filter } = require('lodash');
|
||||
const { argv } = require('yargs');
|
||||
const Xss = require('xss');
|
||||
const { findFileSync } = require('@hydrooj/utils/lib/utils');
|
||||
const status = require('@hydrooj/utils/lib/status');
|
||||
const markdown = require('./markdown');
|
||||
|
||||
const { misc, buildContent, avatar } = global.Hydro.lib;
|
||||
@@ -143,7 +144,7 @@ class Nunjucks extends nunjucks.Environment {
|
||||
}
|
||||
if (typeof s === 'object' && !(s instanceof Array)) {
|
||||
const langs = Object.keys(s);
|
||||
const f = langs.filter(i => i.startsWith(language));
|
||||
const f = langs.filter((i) => i.startsWith(language));
|
||||
if (s[language]) s = s[language];
|
||||
else if (f.length) s = s[f[0]];
|
||||
else s = s[langs[0]];
|
||||
@@ -190,6 +191,7 @@ env.addGlobal('typeof', (o) => typeof o);
|
||||
env.addGlobal('datetimeSpan', misc.datetimeSpan);
|
||||
env.addGlobal('paginate', misc.paginate);
|
||||
env.addGlobal('size', misc.size);
|
||||
env.addGlobal('utils', { status });
|
||||
env.addGlobal('avatarUrl', avatar);
|
||||
env.addGlobal('formatSeconds', misc.formatSeconds);
|
||||
env.addGlobal('model', global.Hydro.model);
|
||||
|
||||
@@ -95,9 +95,6 @@ const prismjsApiWrap = {
|
||||
const $code = $(code);
|
||||
const $pre = $code.parent();
|
||||
$pre.addClass('syntax-hl');
|
||||
if ($pre.closest('[data-syntax-hl-show-line-number]')) {
|
||||
$pre.addClass('line-numbers');
|
||||
}
|
||||
const language = ($(code).attr('class') || '').trim();
|
||||
const astyle = language.match(/astyle-([a-z]+)/);
|
||||
if (format && astyle && astyle[1]) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.6.34",
|
||||
"version": "4.7.0",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
@@ -22,7 +22,7 @@
|
||||
"@babel/preset-react": "^7.13.13",
|
||||
"@babel/register": "^7.13.14",
|
||||
"@babel/runtime-corejs2": "^7.14.0",
|
||||
"@hydrooj/utils": "^1.0.7",
|
||||
"@hydrooj/utils": "^1.0.10",
|
||||
"ansi_up": "^5.0.1",
|
||||
"autoprefixer": "^9.8.6",
|
||||
"babel-loader": "^8.2.2",
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<td class="col--status record-status--border {{ class }} {{ model.builtin.STATUS_CODES[rdoc.status] }}">
|
||||
<div class="col--status__text">
|
||||
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[rdoc.status] }}"></span>
|
||||
<span style="color: {{ utils.status.getScoreColor(rdoc.score|default(0)) }}">{{ rdoc.score|default(0) }}</span>
|
||||
<a href="{{ url('record_detail', rid=rdoc[rid_key]) }}" class="record-status--text {{ model.builtin.STATUS_CODES[rdoc.status] }}">
|
||||
{{ model.builtin.STATUS_TEXTS[rdoc.status] }}
|
||||
</a>
|
||||
|
||||
@@ -40,7 +40,9 @@
|
||||
{% if column.type == 'user' %}
|
||||
{{ user.render_inline(udict[column.raw], badge=false) }}
|
||||
{% elif column.type == 'record' and column.raw %}
|
||||
<a href="{{ url('record_detail', rid=column.raw) }}">{{ column.value }}</a>
|
||||
<a href="{{ url('record_detail', rid=column.raw) }}">
|
||||
<span style="font-weight:bold;color:{{ utils.status.getScoreColor(column.value) }}">{{ column.value }}</span>
|
||||
</a>
|
||||
{% else %}
|
||||
{{ column.value }}
|
||||
{% endif %}
|
||||
|
||||
@@ -10,28 +10,11 @@
|
||||
<div class="section__header">
|
||||
<h1 class="section__title">{{ _('Code') }}</h1>
|
||||
</div>
|
||||
<div class="section__body" data-syntax-hl-show-line-number>
|
||||
<pre><code class="language-{{ (model.system.get('ui-default.lang_highlight_id')|parseYaml)[rdoc['lang']] }}">{{ rdoc['code'] }}</code></pre>
|
||||
<div class="section__body">
|
||||
<pre><code class="line-numbers language-{{ (model.system.get('ui-default.lang_highlight_id')|parseYaml)[rdoc['lang']] }}">{{ rdoc['code'] }}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if rdoc['stdout'] or rdoc['stderr'] %}
|
||||
<div class="section">
|
||||
<div class="section__header">
|
||||
<h1 class="section__title">{{ _('Stdout') }}</h1>
|
||||
</div>
|
||||
{% if rdoc['stdout'] %}
|
||||
<div class="section__body" data-syntax-hl-show-line-number>
|
||||
<pre><code>{{ rdoc['stdout']|ansi|safe }}</code></pre>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if rdoc['stderr'] %}
|
||||
<div class="section__body" data-syntax-hl-show-line-number>
|
||||
<pre><code>{{ rdoc['stderr']|ansi|safe }}</code></pre>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="medium-3 columns">
|
||||
<div class="section side">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<div class="section__header">
|
||||
<h1 class="section__title">
|
||||
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[rdoc['status']] }}"></span>
|
||||
<span style="color: {{ utils.status.getScoreColor(rdoc.score|default(0)) }}">{{ rdoc.score|default(0) }}</span>
|
||||
<span class="record-status--text {{ model.builtin.STATUS_CODES[rdoc['status']] }}">
|
||||
{{ model.builtin.STATUS_TEXTS[rdoc['status']] }}
|
||||
</span>
|
||||
|
||||
@@ -16,24 +16,40 @@
|
||||
<div class="section__body">
|
||||
<div class="row">
|
||||
<!-- TODO: replace with form_builder -->
|
||||
<div class="medium-4 columns">
|
||||
<div class="medium-3 columns">
|
||||
<label class="filter-user">
|
||||
{{ _('By Username / UID') }}
|
||||
<input name="uidOrName" type="text" class="textbox" value="{{ filterUidOrName }}" autocomplete="off" data-autofocus>
|
||||
</label>
|
||||
</div>
|
||||
<div class="medium-4 columns">
|
||||
<div class="medium-3 columns">
|
||||
<label>
|
||||
{{ _('By Problem') }}
|
||||
<input name="pid" type="text" class="textbox" value="{{ filterPid }}">
|
||||
</label>
|
||||
</div>
|
||||
<div class="medium-4 columns">
|
||||
<div class="medium-3 columns">
|
||||
<label>
|
||||
{{ _('By Contest') }}
|
||||
<input name="tid" type="text" class="textbox" value="{{ filterTid }}">
|
||||
</label>
|
||||
</div>
|
||||
<div class="medium-3 columns">
|
||||
<label>
|
||||
{{ _('By Status') }}
|
||||
</label>
|
||||
<select class="inline compact select" name="status">
|
||||
<option value="">{{ _('All Submissions') }}</option>
|
||||
<option value="1">{{ _('Accepted') }}</option>
|
||||
<option value="2">{{ _('Wrong Answer') }}</option>
|
||||
<option value="3">{{ _('Time Limit Exceeded') }}</option>
|
||||
<option value="4">{{ _('Memory Limit Exceeded') }}</option>
|
||||
<option value="6">{{ _('Runtime Error') }}</option>
|
||||
<option value="7">{{ _('Compile Error') }}</option>
|
||||
<option value="8">{{ _('System Error') }}</option>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user