mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: fix link display
This commit is contained in:
1 parent
43d589c84d
commit
385b8f4fe6
4 files changed
+16
-8
No files matched your search
@@ -11,7 +11,7 @@ const markdown = require('./markdown');
|
|||||||
|
|
||||||
const { misc, buildContent, avatar } = global.Hydro.lib;
|
const { misc, buildContent, avatar } = global.Hydro.lib;
|
||||||
|
|
||||||
let template = argv.options.template;
|
let { template } = argv.options;
|
||||||
if (template && typeof template !== 'string') template = findFileSync('@hydrooj/ui-default/templates');
|
if (template && typeof template !== 'string') template = findFileSync('@hydrooj/ui-default/templates');
|
||||||
else if (template) template = findFileSync(template);
|
else if (template) template = findFileSync(template);
|
||||||
|
|
||||||
@@ -139,6 +139,13 @@ env.addGlobal('set', (obj, key, val) => {
|
|||||||
env.addGlobal('findSubModule', (prefix) => {
|
env.addGlobal('findSubModule', (prefix) => {
|
||||||
filter(Object.keys(global.Hydro.ui.template), (n) => n.startsWith(prefix));
|
filter(Object.keys(global.Hydro.ui.template), (n) => n.startsWith(prefix));
|
||||||
});
|
});
|
||||||
|
env.addGlobal('parseContestProblemId', (pdoc, tdoc) => {
|
||||||
|
if (tdoc.pids[parseInt(pdoc.pid, 36) - 10]) return pdoc.pid;
|
||||||
|
let cur = tdoc.pids.indexOf(pdoc.docId);
|
||||||
|
if (cur !== -1) return (cur + 10).toString(36).toUpperCase();
|
||||||
|
cur = tdoc.pids.indexOf(`${pdoc.domainId}:${pdoc.docId}`);
|
||||||
|
return (cur + 10).toString(36).toUpperCase();
|
||||||
|
});
|
||||||
|
|
||||||
async function render(name, state) {
|
async function render(name, state) {
|
||||||
// eslint-disable-next-line no-return-await
|
// eslint-disable-next-line no-return-await
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.11.7",
|
"version": "4.11.8",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
{% macro render_problem_title(pdoc, tdoc=none, show_tags=true, show_invisible_flag=true, invalid=false) %}
|
{% macro render_problem_title(pdoc, tdoc=none, show_tags=true, show_invisible_flag=true, invalid=false) %}
|
||||||
{%- if not invalid %}
|
{%- if not invalid %}
|
||||||
<a
|
<a
|
||||||
{%- if tdoc and tdoc.docType == model.document.TYPE_CONTEST %}
|
{% if tdoc -%}
|
||||||
href="{{ url('contest_detail_problem', tid=tdoc.docId, pid=pdoc.pid|default(pdoc.docId)) }}"
|
href="{{ url(
|
||||||
{%- elif tdoc and tdoc.docType == model.document.TYPE_HOMEWORK %}
|
'contest_detail_problem' if tdoc.docType == model.document.TYPE_CONTEST else 'homework_detail_problem',
|
||||||
href="{{ url('homework_detail_problem', tid=tdoc.docId, pid=pdoc.pid|default(pdoc.docId)) }}"
|
tid=tdoc.docId, pid=parseContestProblemId(pdoc, tdoc)
|
||||||
{%- else %}
|
) }}"
|
||||||
|
{%- else -%}
|
||||||
href="{{ url('problem_detail', pid=pdoc.pid|default(pdoc.docId)) }}"
|
href="{{ url('problem_detail', pid=pdoc.pid|default(pdoc.docId)) }}"
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
{% if tdoc %}
|
{% if tdoc %}
|
||||||
<dt>{{ _('Contest') if tdoc.docType == model.document.TYPE_CONTEST else _('Homework') }}</dt>
|
<dt>{{ _('Contest') if tdoc.docType == model.document.TYPE_CONTEST else _('Homework') }}</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<a href="{{ url('contest_detail', tid=tdoc.docId) if tdoc.docType == model.document.TYPE_CONTEST else url('homework_detail', tid=tdoc.docId) }}">{{ tdoc.title }}</a>
|
<a href="{{ url('contest_detail' if tdoc.docType == model.document.TYPE_CONTEST else 'homework_detail', tid=tdoc.docId) }}">{{ tdoc.title }}</a>
|
||||||
</dd>
|
</dd>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<dt>{{ _('Language') }}</dt>
|
<dt>{{ _('Language') }}</dt>
|
||||||
|
|||||||
Reference in new issue
Block a user