diff --git a/packages/hydrooj/src/handler/contest.ts b/packages/hydrooj/src/handler/contest.ts index 2cb4f27c..fcd42bb2 100644 --- a/packages/hydrooj/src/handler/contest.ts +++ b/packages/hydrooj/src/handler/contest.ts @@ -162,6 +162,7 @@ export class ContestDetailBaseHandler extends Handler { checker: () => contest.canShowScoreboard.call(this, this.tdoc, true), }, { + name: 'problem_detail', displayName: `${String.fromCharCode(65 + this.tdoc.pids.indexOf(pdoc.docId))}. ${pdoc.title}`, args: { query: { tid }, pid: pdoc.docId, prefix: 'contest_detail_problem' }, checker: () => 'pdoc' in this, diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index 5bee9f11..8af0406d 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -344,6 +344,7 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler { const pdoc = await problem.get(this.pdoc.reference.domainId, this.pdoc.reference.pid); if (!ddoc || !pdoc) throw new ProblemNotFoundError(this.pdoc.reference.domainId, this.pdoc.reference.pid); this.pdoc.config = pdoc.config; + this.pdoc.additional_file = pdoc.additional_file; } if (typeof this.pdoc.config !== 'string') { let baseLangs; @@ -384,7 +385,8 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler { const fields = ['attend', 'startAt']; if (this.tdoc.duration) fields.push('endAt'); if (contest.canShowSelfRecord.call(this, this.tdoc, true)) fields.push('detail'); - this.response.body.tsdoc = pick(this.tsdoc, fields); + this.tsdoc = pick(this.tsdoc, fields); + this.response.body.tsdoc = this.tsdoc; } this.response.template = 'problem_detail.html'; this.UiContext.extraTitleContent = this.pdoc.title; @@ -502,6 +504,7 @@ export class ProblemSubmitHandler extends ProblemDetailHandler { pdoc: this.pdoc, udoc: this.udoc, tdoc: this.tdoc, + tsdoc: this.tsdoc, title: this.pdoc.title, page_name: this.tdoc ? this.tdoc.rule === 'homework' diff --git a/packages/ui-default/templates/discussion_main_or_node.html b/packages/ui-default/templates/discussion_main_or_node.html index 3fe29180..a37da03a 100644 --- a/packages/ui-default/templates/discussion_main_or_node.html +++ b/packages/ui-default/templates/discussion_main_or_node.html @@ -13,6 +13,9 @@ {% include "partials/problem_sidebar.html" %} {% elif vnode.type == model.document.TYPE_CONTEST %} {% set tdoc = vnode %} + {%- if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) -%} + {% set tsdoc = { attend: tdoc.attend } %} + {%- endif -%} {% set owner_udoc = udict[vnode.owner] %} {% include "partials/contest_sidebar.html" %} {% else %} diff --git a/packages/ui-default/templates/partials/problem_files.html b/packages/ui-default/templates/partials/problem_files.html index df40c41d..ebc85ff3 100644 --- a/packages/ui-default/templates/partials/problem_files.html +++ b/packages/ui-default/templates/partials/problem_files.html @@ -6,7 +6,8 @@

{{ _('This is a copy of another problem.') }}

- {% elif _files.length %} + {% endif %} + {% if _files.length %} {% if not sidebar %}{% endif %} @@ -53,7 +54,7 @@ {%- endfor -%}
- {% else %} + {% elif not reference %} {{ nothing.render('No {0} at current.', compact=sidebar, args=[_(filetype)]) }} {% endif %} - \ No newline at end of file + diff --git a/packages/ui-default/templates/problem_files.html b/packages/ui-default/templates/problem_files.html index c6c4b287..2381dd6e 100644 --- a/packages/ui-default/templates/problem_files.html +++ b/packages/ui-default/templates/problem_files.html @@ -31,7 +31,7 @@

{{ _('Files') }}

- {% if handler.user.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %} + {% if (handler.user.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM)) and not reference %} {% endif %} @@ -41,7 +41,7 @@ {% include "partials/problem_files.html" %}
- {% if handler.user.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %} + {% if (handler.user.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM)) and not reference %} {% endif %}
diff --git a/packages/ui-default/templates/user_detail.html b/packages/ui-default/templates/user_detail.html index 2a4f0e8d..f62537ec 100644 --- a/packages/ui-default/templates/user_detail.html +++ b/packages/ui-default/templates/user_detail.html @@ -153,7 +153,7 @@
-
{{ udoc.nLiked or 0 }}
+
{{ udoc.nLike or 0 }}
{{ _('Solutions Liked') }}