mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
1 parent
41a2f2228f
commit
17ec582804
4 files changed
+7
-10
No files matched your search
@@ -170,17 +170,15 @@ export class ProblemMainHandler extends Handler {
|
|||||||
pdocs.map((i) => i.docId),
|
pdocs.map((i) => i.docId),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
let qs = sortStrategy !== 'default' ? `sort=${sortStrategy}` : '';
|
|
||||||
if (q) qs += `${qs ? '&' : ''}q=${encodeURIComponent(q)}`;
|
|
||||||
if (pjax) {
|
if (pjax) {
|
||||||
this.response.body = {
|
this.response.body = {
|
||||||
title: this.renderTitle(this.translate('problem_main')),
|
title: this.renderTitle(this.translate('problem_main')),
|
||||||
fragments: (await Promise.all([
|
fragments: (await Promise.all([
|
||||||
this.renderHTML('partials/problem_list.html', {
|
this.renderHTML('partials/problem_list.html', {
|
||||||
page, ppcount, pcount, pdocs, psdict, qs, q, sort: sortStrategy,
|
page, ppcount, pcount, pdocs, psdict, qs: q, sort: sortStrategy,
|
||||||
}),
|
}),
|
||||||
this.renderHTML('partials/problem_stat.html', { pcount, pcountRelation: this.queryContext.pcountRelation }),
|
this.renderHTML('partials/problem_stat.html', { pcount, pcountRelation: this.queryContext.pcountRelation }),
|
||||||
this.renderHTML('partials/problem_lucky.html', { q }),
|
this.renderHTML('partials/problem_lucky.html', { qs: q }),
|
||||||
])).map((i) => ({ html: i })),
|
])).map((i) => ({ html: i })),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@@ -191,8 +189,7 @@ export class ProblemMainHandler extends Handler {
|
|||||||
pcountRelation: this.queryContext.pcountRelation,
|
pcountRelation: this.queryContext.pcountRelation,
|
||||||
pdocs,
|
pdocs,
|
||||||
psdict,
|
psdict,
|
||||||
qs,
|
qs: q,
|
||||||
q,
|
|
||||||
sort: sortStrategy,
|
sort: sortStrategy,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
{% if not pdocs.length %}
|
{% if not pdocs.length %}
|
||||||
{{ nothing.render('Sorry, there are no problems in the problem set.') }}
|
{{ nothing.render('Sorry, there are no problems in the problem set.') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ paginator.render(page, ppcount, position='top', add_qs=qs) }}
|
{{ paginator.render(page, ppcount, position='top', add_qs=('q=' + qs if qs else '')) }}
|
||||||
<table class="data-table hide-problem-tag">
|
<table class="data-table hide-problem-tag">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col class="col--checkbox display-mode-hide">
|
<col class="col--checkbox display-mode-hide">
|
||||||
@@ -63,6 +63,6 @@
|
|||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{{ paginator.render(page, ppcount, add_qs=qs) }}
|
{{ paginator.render(page, ppcount, add_qs=('q=' + qs if qs else '')) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<div data-fragment-id="problem_lucky">
|
<div data-fragment-id="problem_lucky">
|
||||||
<p>
|
<p>
|
||||||
<a href="{{ url('problem_random', query={q:q}) if q else url('problem_random') }}" class="expanded button" target="_blank">
|
<a href="{{ url('problem_random', query={q:qs}) if qs else url('problem_random') }}" class="expanded button" target="_blank">
|
||||||
<span class="icon icon-feeling-lucky"></span> {{ _('Lucky') }}
|
<span class="icon icon-feeling-lucky"></span> {{ _('Lucky') }}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<div class="section__body no-padding">
|
<div class="section__body no-padding">
|
||||||
<form method="get" id="searchForm" action="{{ url('problem_main') }}">
|
<form method="get" id="searchForm" action="{{ url('problem_main') }}">
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<input name="q" type="text" value="{{ q }}" placeholder="{{ _('Search') }}">
|
<input name="q" type="text" value="{{ qs }}" placeholder="{{ _('Search') }}">
|
||||||
{% include "partials/problem_stat.html" %}
|
{% include "partials/problem_stat.html" %}
|
||||||
<select name="sort" class="search-sort">
|
<select name="sort" class="search-sort">
|
||||||
{%- for sortType in ["default", "recent"] -%}
|
{%- for sortType in ["default", "recent"] -%}
|
||||||
|
|||||||
Reference in new issue
Block a user