diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 4f31c673f..4d753ccd6 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "2.29.22", + "version": "2.29.23", "bin": "bin/hydrooj.js", "main": "dist/loader.js", "typings": "dist/loader.d.ts", diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index 6a0b516b3..f9cdee063 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -38,7 +38,7 @@ export class ProblemHandler extends Handler { page, pcount, ppcount, pdocs, psdict, category, } = this.response.body; this.response.body = { - title: this.renderTitle(category), + title: this.renderTitle(this.translate('problem_main')), fragments: (await Promise.all([ this.renderHTML('partials/problem_list.html', { page, ppcount, pcount, pdocs, psdict, @@ -92,8 +92,10 @@ export class ProblemMainHandler extends ProblemHandler { if (q) { const pdoc = await problem.get(domainId, +q || q, problem.PROJECTION_LIST); if (pdoc) { + const count = pdocs.length; pdocs = pdocs.filter((doc) => doc.docId !== pdoc.docId); pdocs.unshift(pdoc); + pcount = pcount - count + pdocs.length; } } if (this.user.hasPriv(PRIV.PRIV_USER_PROFILE)) { diff --git a/packages/hydrooj/src/service/server.ts b/packages/hydrooj/src/service/server.ts index 6c2738c5c..c4e03e5b6 100644 --- a/packages/hydrooj/src/service/server.ts +++ b/packages/hydrooj/src/service/server.ts @@ -683,6 +683,8 @@ async function handle(ctx, HandlerClass, checker) { await bail(`handler/before/${HandlerClass.name.replace(/Handler$/, '')}`, h); await bail('handler/before', h); if (h[method]) await h[method](args); + await bail(`handler/before-operation/${HandlerClass.name.replace(/Handler$/, '')}`, h); + await bail('handler/before-operation', h); if (operation) await h[`post${operation}`](args); await bail(`handler/after/${HandlerClass.name.replace(/Handler$/, '')}`, h); await bail('handler/after', h); diff --git a/packages/ui-default/package.json b/packages/ui-default/package.json index 5fc18926c..089425479 100644 --- a/packages/ui-default/package.json +++ b/packages/ui-default/package.json @@ -1,6 +1,6 @@ { "name": "@hydrooj/ui-default", - "version": "4.12.18", + "version": "4.12.19", "author": "undefined ", "license": "AGPL-3.0", "main": "hydro.js", diff --git a/packages/ui-default/pages/problem_main.page.js b/packages/ui-default/pages/problem_main.page.js index d1a4a4de7..247bb9a6a 100644 --- a/packages/ui-default/pages/problem_main.page.js +++ b/packages/ui-default/pages/problem_main.page.js @@ -218,6 +218,15 @@ const page = new NamedPage(['problem_main', 'problem_category'], () => { ev.preventDefault(); updateSelection(); }); + $('#searchForm').on('submit', () => { + updateSelection(); + return false; + }); + let update; + $('#searchForm').find('input').on('input', () => { + if (update) clearTimeout(update); + update = setTimeout(updateSelection, 500); + }); $(document).on('click', 'a.pager__item', (ev) => { ev.preventDefault(); pjax.request({ url: $(ev.currentTarget).attr('href') }).then(() => { diff --git a/packages/ui-default/pages/problem_main.page.styl b/packages/ui-default/pages/problem_main.page.styl index beb1da6b0..a775f790d 100644 --- a/packages/ui-default/pages/problem_main.page.styl +++ b/packages/ui-default/pages/problem_main.page.styl @@ -1,10 +1,10 @@ .page--problem_main .page--problem_category .col--checkbox - width: rem(60px) + width: rem(61px) .col--pid - width: rem(80px) + width: rem(81px) .col--status width: rem(140px) @@ -108,4 +108,40 @@ display: none .edit-mode .edit-mode-hide - display: none \ No newline at end of file + display: none + +.data-table > tbody > tr + height: 40.15px + +.data-table > thead > tr + height: 54.9px + +.search + width: 100% + position: relative + display: flex + +.search > input + width: 100% + border: 1px solid #cccccc + border-right: none + padding: 5px + height: 36px + outline: none + color: #000000 + +.search > button + width: 40px + height: 36px + border: 1px solid #00B4CC + background: #00B4CC + text-align: center + color: #fff + cursor: pointer + font-size: 20px + +.search > div + position: absolute + right: 50px + top: 8px + font-size: rem(17px) \ No newline at end of file diff --git a/packages/ui-default/templates/partials/problem_stat.html b/packages/ui-default/templates/partials/problem_stat.html index 56604e18d..6c541585f 100644 --- a/packages/ui-default/templates/partials/problem_stat.html +++ b/packages/ui-default/templates/partials/problem_stat.html @@ -1,3 +1,3 @@ -
+

{{ _('{0} problems').format(pcount) }}

\ No newline at end of file diff --git a/packages/ui-default/templates/problem_edit.html b/packages/ui-default/templates/problem_edit.html index 9aa1620ce..e48f8d78a 100644 --- a/packages/ui-default/templates/problem_edit.html +++ b/packages/ui-default/templates/problem_edit.html @@ -17,7 +17,7 @@ {{ _('pid') }}
diff --git a/packages/ui-default/templates/problem_main.html b/packages/ui-default/templates/problem_main.html index 5cb9b79dd..5431cbf78 100644 --- a/packages/ui-default/templates/problem_main.html +++ b/packages/ui-default/templates/problem_main.html @@ -11,6 +11,15 @@
+
+ +
{% include "partials/problem_list.html" %}
@@ -48,30 +57,6 @@
{% endif %} -
-
-

{{ _('Categories') }}

-
-
- {% include "partials/category.html" %} -
-
- {% include "partials/problem_lucky.html" %} -
-
-
-
-

{{ _('Search') }}

-
-
-
- - -
-
-
{% if handler.user.hasPerm(perm.PERM_CREATE_PROBLEM) %}
@@ -93,10 +78,15 @@
{% endif %}
-
-

{{ _('Statistics') }}

+
+

{{ _('Categories') }}

+
+
+ {% include "partials/category.html" %} +
+
+ {% include "partials/problem_lucky.html" %}
- {% include "partials/problem_stat.html" %}