diff --git a/packages/ui-default/backendlib/template.js b/packages/ui-default/backendlib/template.js index 07faee7f3..6c97c61b9 100644 --- a/packages/ui-default/backendlib/template.js +++ b/packages/ui-default/backendlib/template.js @@ -96,6 +96,18 @@ class Nunjucks extends nunjucks.Environment { if (s instanceof Array) s = buildContent(s, html ? 'html' : 'markdown', (str) => str.translate(language)); return ensureTag(html ? xss.process(s) : markdown.render(s)); }); + this.addFilter('contentLang', (content) => { + let s = ''; + try { + s = JSON.parse(content); + } catch { + s = content; + } + if (typeof s === 'object' && !(s instanceof Array)) { + return Object.keys(s); + } + return []; + }); this.addFilter('log', (self) => { console.log(self); return self; diff --git a/packages/ui-default/pages/problem_detail.page.styl b/packages/ui-default/pages/problem_detail.page.styl new file mode 100644 index 000000000..814020d97 --- /dev/null +++ b/packages/ui-default/pages/problem_detail.page.styl @@ -0,0 +1,20 @@ +.page--problem_detail + .section__tab-header + padding-top: 0; + + .section__tab-container + .section__body + padding-top: 0 + + .section__tab-header-item + border-top: 3px solid transparent; + transition: border-color 0.2s, background 0.2s, color 0.2s; + transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + margin-right: 0; + color: #182026 !important; + + &:hover + border-color: #5f9fd6; + background: #f8f8f8; + + &.tab--active + border-color: #ed5f82; \ No newline at end of file diff --git a/packages/ui-default/templates/problem_detail.html b/packages/ui-default/templates/problem_detail.html index f3aa33e11..126aa8b89 100644 --- a/packages/ui-default/templates/problem_detail.html +++ b/packages/ui-default/templates/problem_detail.html @@ -75,6 +75,19 @@
@@ -91,7 +104,7 @@{% endif %} - {{ pdoc.content|content(handler.user.viewLang or handler.session.viewLang, pdoc.html)|safe }} + {{ pdoc.content|content(handler.request.query.lang or handler.user.viewLang or handler.session.viewLang, pdoc.html)|safe }}{{ _('You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.') }}