mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: add paginator to top of problem_main page
This commit is contained in:
1 parent
51527c7f79
commit
11cc42b943
6 files changed
+22
-10
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "3.1.42",
|
"version": "3.1.43",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export function datetimeSpan(dt: Date | ObjectID, relative = true, format = 'YYY
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function* paginate(page: number, numPages: number) {
|
export function* paginate(page: number, numPages: number) {
|
||||||
const radius = 2;
|
const radius = 5;
|
||||||
let first: number;
|
let first: number;
|
||||||
let last: number;
|
let last: number;
|
||||||
if (page > 1) {
|
if (page > 1) {
|
||||||
|
|||||||
@@ -1,11 +1,23 @@
|
|||||||
.pager
|
.pager
|
||||||
margin-bottom: rem(10px)
|
|
||||||
border-top: 2px solid $pager-border-color
|
|
||||||
text-align: center
|
text-align: center
|
||||||
font-size: rem($font-size-small)
|
font-size: rem($font-size-small)
|
||||||
|
|
||||||
&:empty
|
&:empty
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
|
&.pager-bottom
|
||||||
|
margin-bottom: rem(10px)
|
||||||
|
border-top: 2px solid $pager-border-color
|
||||||
|
|
||||||
|
.pager__item
|
||||||
|
border-top: 2px solid $pager-border-color
|
||||||
|
|
||||||
|
&.pager-top
|
||||||
|
margin-top: rem(10px)
|
||||||
|
border-bottom: 2px solid $pager-border-color
|
||||||
|
|
||||||
|
.pager__item
|
||||||
|
border-bottom: 2px solid $pager-border-color
|
||||||
|
|
||||||
li
|
li
|
||||||
margin: 0
|
margin: 0
|
||||||
@@ -17,7 +29,6 @@
|
|||||||
padding: rem(10px)
|
padding: rem(10px)
|
||||||
text-decoration: none
|
text-decoration: none
|
||||||
border: 0
|
border: 0
|
||||||
border-top: 2px solid $pager-border-color
|
|
||||||
transition: border-top .2s linear, color .2s linear
|
transition: border-top .2s linear, color .2s linear
|
||||||
color: #a7a7a7
|
color: #a7a7a7
|
||||||
|
|
||||||
@@ -32,8 +43,8 @@
|
|||||||
color: #666
|
color: #666
|
||||||
|
|
||||||
&.current
|
&.current
|
||||||
color: $secondary-color
|
color: $secondary-color !important
|
||||||
border-color: $secondary-color
|
border-color: $secondary-color !important
|
||||||
|
|
||||||
+mobile()
|
+mobile()
|
||||||
.pager__item
|
.pager__item
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.26.24",
|
"version": "4.26.25",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{% macro render(page, num_pages, add_qs='') %}
|
{% macro render(page, num_pages, add_qs='', position='bottom') %}
|
||||||
{% if num_pages > 0 %}
|
{% if num_pages > 0 %}
|
||||||
<ul class="pager">
|
<ul class="pager pager-{{ position }}">
|
||||||
{%- for type, page0 in paginate(page, num_pages) -%}
|
{%- for type, page0 in paginate(page, num_pages) -%}
|
||||||
<li>
|
<li>
|
||||||
{% if type == 'first' %}
|
{% if type == 'first' %}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
{% if not pdocs.length %}
|
{% if not pdocs.length %}
|
||||||
{{ nothing.render('Sorry, there is no problem in the problem set') }}
|
{{ nothing.render('Sorry, there is no problem in the problem set') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{{ paginator.render(page, ppcount, position='top') }}
|
||||||
<table class="data-table">
|
<table class="data-table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col class="col--checkbox display-mode-hide">
|
<col class="col--checkbox display-mode-hide">
|
||||||
|
|||||||
Reference in new issue
Block a user