mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: fix group filter display
This commit is contained in:
5 files changed
+9
-4
No files matched your search
@@ -77,7 +77,7 @@ export class ContestListHandler extends Handler {
|
|||||||
@param('page', Types.PositiveInt, true)
|
@param('page', Types.PositiveInt, true)
|
||||||
async get(domainId: string, rule = '', group = '', page = 1) {
|
async get(domainId: string, rule = '', group = '', page = 1) {
|
||||||
if (rule && contest.RULES[rule].hidden) throw new BadRequestError();
|
if (rule && contest.RULES[rule].hidden) throw new BadRequestError();
|
||||||
const groups = (await user.listGroup(domainId, this.user._id)).map((i) => i.name);
|
const groups = (await user.listGroup(domainId, this.user._id)).map((i) => i.name).filter((i) => !Number.isSafeInteger(+i));
|
||||||
if (group && !groups.includes(group)) throw new NotAssignedError(group);
|
if (group && !groups.includes(group)) throw new NotAssignedError(group);
|
||||||
const rules = Object.keys(contest.RULES).filter((i) => !contest.RULES[i].hidden);
|
const rules = Object.keys(contest.RULES).filter((i) => !contest.RULES[i].hidden);
|
||||||
const q = {
|
const q = {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class HomeworkMainHandler extends Handler {
|
|||||||
@param('group', Types.Name, true)
|
@param('group', Types.Name, true)
|
||||||
@param('page', Types.PositiveInt, true)
|
@param('page', Types.PositiveInt, true)
|
||||||
async get(domainId: string, group = '', page = 1) {
|
async get(domainId: string, group = '', page = 1) {
|
||||||
const groups = (await user.listGroup(domainId, this.user._id)).map((i) => i.name);
|
const groups = (await user.listGroup(domainId, this.user._id)).map((i) => i.name).filter((i) => !Number.isSafeInteger(+i));
|
||||||
if (group && !groups.includes(group)) throw new NotAssignedError(group);
|
if (group && !groups.includes(group)) throw new NotAssignedError(group);
|
||||||
const cursor = contest.getMulti(domainId, {
|
const cursor = contest.getMulti(domainId, {
|
||||||
rule: 'homework',
|
rule: 'homework',
|
||||||
|
|||||||
@@ -555,6 +555,7 @@ New: 创建
|
|||||||
No {0} at current.: 当前没有{0}。
|
No {0} at current.: 当前没有{0}。
|
||||||
No comments so far...: 目前还没有评论...
|
No comments so far...: 目前还没有评论...
|
||||||
No discussion yet...: 目前没有讨论…
|
No discussion yet...: 目前没有讨论…
|
||||||
|
No group available: 没有可用小组
|
||||||
No Permission to Attend Contest: 您没有权限参加比赛
|
No Permission to Attend Contest: 您没有权限参加比赛
|
||||||
No Permission to Claim Homework: 您没有权限认领作业
|
No Permission to Claim Homework: 您没有权限认领作业
|
||||||
No Permission to Create a Discussion: 您没有权限创建讨论
|
No Permission to Create a Discussion: 您没有权限创建讨论
|
||||||
|
|||||||
@@ -60,14 +60,15 @@
|
|||||||
<div class="section__tools">
|
<div class="section__tools">
|
||||||
<form method="get" name="filter-form">
|
<form method="get" name="filter-form">
|
||||||
{{ _('Show') }}:
|
{{ _('Show') }}:
|
||||||
{% if groups.length %}
|
|
||||||
<select class="inline compact select" name="group">
|
<select class="inline compact select" name="group">
|
||||||
<option value=""{% if not group %} selected{% endif %}>{{ _('All') }}</option>
|
<option value=""{% if not group %} selected{% endif %}>{{ _('All') }}</option>
|
||||||
{%- for g in groups -%}
|
{%- for g in groups -%}
|
||||||
<option value="{{ g }}"{% if group == g %} selected{% endif %}>{{ g }}</option>
|
<option value="{{ g }}"{% if group == g %} selected{% endif %}>{{ g }}</option>
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
|
{%- if not groups|length -%}
|
||||||
|
<option disabled>{{ _('No group available') }}</option>
|
||||||
|
{%- endif -%}
|
||||||
</select>
|
</select>
|
||||||
{% endif %}
|
|
||||||
<select class="inline compact select" name="rule">
|
<select class="inline compact select" name="rule">
|
||||||
<option value=""{% if not rule %} selected{% endif %}>{{ _('All') }}</option>
|
<option value=""{% if not rule %} selected{% endif %}>{{ _('All') }}</option>
|
||||||
{%- for k, v in model.contest.RULES -%}
|
{%- for k, v in model.contest.RULES -%}
|
||||||
|
|||||||
@@ -22,6 +22,9 @@
|
|||||||
{%- for g in groups -%}
|
{%- for g in groups -%}
|
||||||
<option value="{{ g }}"{% if group == g %} selected{% endif %}>{{ g }}</option>
|
<option value="{{ g }}"{% if group == g %} selected{% endif %}>{{ g }}</option>
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
|
{%- if not groups|length -%}
|
||||||
|
<option disabled>{{ _('No group available') }}</option>
|
||||||
|
{%- endif -%}
|
||||||
</select>
|
</select>
|
||||||
<button type="submit" class="compact button hasjs--hide">
|
<button type="submit" class="compact button hasjs--hide">
|
||||||
{{ _('Search') }}
|
{{ _('Search') }}
|
||||||
|
|||||||
Reference in new issue
Block a user