This commit is contained in:
undefined committed 2022-01-24 00:00:37 +08:00
1 parent 688ccf811b
commit 775301c001
7 files changed
+56 -75

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.3.14",
"version": "3.3.15",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+11 -9
View File
@@ -301,15 +301,17 @@ class UserDetailHandler extends Handler {
const pdocs: ProblemDoc[] = [];
const acInfo: Record<string, number> = {};
const canViewHidden = this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN) || this.user._id;
await Promise.all([domainId, ...(union?.union || [])].map(async (did) => {
const psdocs = await problem.getMultiStatus(did, { uid, status: STATUS.STATUS_ACCEPTED }).toArray();
pdocs.push(...Object.values(
await problem.getList(
did, psdocs.map((i) => i.docId), canViewHidden,
this.user.group, false, undefined, true,
),
));
}));
if (this.user.hasPerm(PERM.PERM_VIEW_PROBLEM)) {
await Promise.all([domainId, ...(union?.union || [])].map(async (did) => {
const psdocs = await problem.getMultiStatus(did, { uid, status: STATUS.STATUS_ACCEPTED }).toArray();
pdocs.push(...Object.values(
await problem.getList(
did, psdocs.map((i) => i.docId), canViewHidden,
this.user.group, false, problem.PROJECTION_LIST, true,
),
));
}));
}
for (const pdoc of pdocs) {
for (const tag of pdoc.tag) {
if (acInfo[tag]) acInfo[tag]++;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.30.4",
"version": "4.30.5",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "hydro.js",
@@ -3,7 +3,7 @@
{% set _linkArgs = { pid:pdoc.pid|default(pdoc.docId) } %}
{% if tdoc %}{{ set(_linkArgs, 'query', {tid:tdoc.docId}) }}{% endif %}
{% if pdoc.domainId !== handler.domainId %}{{ set(_linkArgs, 'domainId', pdoc.domainId) }}{% endif %}
<a href="{{ url('problem_detail', _linkArgs) }}"{% if small %}data-tooltip="{{ pdoc.title }}"{% endif %}>
<a href="{{ url('problem_detail', _linkArgs) }}"{% if small %} data-tooltip="{{ pdoc.title }}"{% endif %}>
{%- endif -%}
{%- if pdoc.domainId !== handler.domainId -%}
{{ pdoc.domainId }}#
@@ -1,4 +1,4 @@
{% macro render_item(icon_name, page_name, args={}, label=none, menu_item=none) %}
{% macro render_item(icon_name, page_name, args={}, label=none, menu_item) %}
{% set target_url = url(page_name, args) if page_name else '#' %}
<li class="menu__item" id="menu-item-{{ menu_item|default(page_name) }}">
<a href="{{ target_url }}" class="menu__link{% if handler.request.path == target_url %} active{% endif %}">
@@ -21,12 +21,12 @@
{% block ogp %}
<meta property="og:site_name" content="{{ (handler.domain|default({ui:[]})).ui.name|default(model.system.get('server.name')) }}" />
<meta property="og:title" content="{{ handler.renderTitle(page_name) }}" />
<meta property="og:url" content="{{ model.system.get('server.url') }}{{ handler.ctx.request.path }}" />
<meta property="og:url" content="{{ model.system.get('server.url') }}{{ handler.ctx.request.path.slice(1) }}" />
<meta property="og:image" content="{{ static_url('favicon-96x96.png') }}" />
{% endblock %}
{% if not isIE(handler.request.headers['user-agent']) %}
<script src="{{ static_url((handler.user|default({})).theme|default('default') + '.theme.js') }}?version={{ global.Hydro.version['ui-default'] }}"></script>
<script type="text/javascript" src="{{ static_url('l/'+handler.user.viewLang) }}"></script>
<script type="text/javascript" src="{{ static_url('l/'+_('__id')) }}"></script>
{% if process.env.DEV %}
<script type="text/javascript" src="{{ static_url('hydro.js') }}?version={{ global.Hydro.version['ui-default'] }}"></script>
{% else %}
@@ -46,11 +46,5 @@
</head>
<body>
{% block body %}{% endblock %}
{% if not isIE(handler.request.headers['user-agent']) %}
<script>
UiContext = '{{ UiContext|json|jsesc|safe }}';
UserContext = '{{ UserContext|json|jsesc|safe }}';
</script>
{% endif %}
</body>
</html>
+39 -54
View File
@@ -103,53 +103,36 @@
</div>
</div>
</div>
<div class="section">
<div class="section__header">
<h2 class="section__title">{{ _('Accepted Problems') }}</h2>
</div>
<div class="typo section__body no-media">
{% set _mark = Math.ceil(pdocs.length/4) %}
{% set _one = pdocs.slice(0, _mark) %}
{% set _two = pdocs.slice(_mark, _mark*2) %}
{% set _three = pdocs.slice(_mark*2, _mark*3) %}
{% set _four = pdocs.slice(_mark*3, pdocs.length - 1) %}
<div class="row">
<div class="medium-3 columns">
<ul>
{% for pdoc in _one %}
<li>{{ problem.render_problem_title(pdoc, show_tags=false, small=true) }}</li>
{% endfor %}
</ul>
</div>
<div class="medium-3 columns">
<ul>
{% for pdoc in _two %}
<li>{{ problem.render_problem_title(pdoc, show_tags=false, small=true) }}</li>
{% endfor %}
</ul>
</div>
<div class="medium-3 columns">
<ul>
{% for pdoc in _three %}
<li>{{ problem.render_problem_title(pdoc, show_tags=false, small=true) }}</li>
{% endfor %}
</ul>
</div>
<div class="medium-3 columns">
<ul>
{% for pdoc in _four %}
<li>{{ problem.render_problem_title(pdoc, show_tags=false, small=true) }}</li>
{% endfor %}
</ul>
{% if pdocs.length %}
<div class="section">
<div class="section__header">
<h2 class="section__title">{{ _('Accepted Problems') }}</h2>
</div>
<div class="typo section__body no-media">
{% set _mark = Math.ceil(pdocs.length/4) %}
{% macro col(pdocs) %}
<div class="medium-3 columns">
<ul>
{% for pdoc in pdocs %}
<li>{{ problem.render_problem_title(pdoc, show_tags=false, small=true) }}</li>
{% endfor %}
</ul>
</div>
{% endmacro %}
<div class="row">
{{ col(pdocs.slice(0, _mark)) }}
{{ col(pdocs.slice(_mark, _mark*2)) }}
{{ col(pdocs.slice(_mark*2, _mark*3)) }}
{{ col(pdocs.slice(_mark*3, pdocs.length - 1)) }}
</div>
</div>
</div>
</div>
{% endif %}
</div>
<div class="medium-3 columns">
{% if isSelfProfile %}
{{ home.render_sidebar() }}
{% endif %}
{% if isSelfProfile %}
{{ home.render_sidebar() }}
{% endif %}
<div class="section side">
<div class="section__body">
<div class="balancer sidebar-user-stat">
@@ -174,19 +157,21 @@
</div>
</div>
</div>
<div class="section side">
<div class="section__header">
<h2 class="section__title">{{ _('Problem Tags') }}</h2>
{% if tags.length %}
<div class="section side">
<div class="section__header">
<h2 class="section__title">{{ _('Problem Tags') }}</h2>
</div>
<div class="typo section__body no-media">
<dl class="exlarge horizontal">
{% for tag in tags %}
<dt>{{ tag[0] }}</dt>
<dd>{{ tag[1] }}</dd>
{% endfor %}
</dl>
</div>
</div>
<div class="typo section__body no-media">
<dl class="exlarge horizontal">
{% for tag in tags %}
<dt>{{ tag[0] }}</dt>
<dd>{{ tag[1] }}</dd>
{% endfor %}
</dl>
</div>
</div>
{% endif %}
</div>
</div>
{% endblock %}