Browse Source

pagination

tree
namasikanam 2 years ago
parent
commit
36c4f970ad
3 changed files with 29 additions and 2 deletions
  1. +1
    -1
      app.py
  2. +9
    -0
      static/css/ordinary.css
  3. +19
    -1
      templates/story.html

+ 1
- 1
app.py View File

@ -204,7 +204,7 @@ def story(story_id):
@bp.route('/create', methods=['POST'])
@login_required
@limiter.limit("15 / hour")
@limiter.limit("66 / hour")
def create():
story_id = request.form.get('story-id')
text = request.form.get('text')

+ 9
- 0
static/css/ordinary.css View File

@ -175,4 +175,13 @@ a:focus, .btn-link:focus {
display: block;
margin-left: auto;
margin-right: auto;
}
nav .page-link {
color: #000;
}
nav .page-item.active .page-link {
background-color: #000;
border-color: #000;
}

+ 19
- 1
templates/story.html View File

@ -48,7 +48,7 @@
</div>
<div class="part2" id="part2">
<div class="paragraph-list twin front qbox part-box">
<div class="paragraph-list twin front qbox part-box" style="border: 0">
<h1 style="margin: -8px -5px 20px">备选后续</h1>
<span style="margin:8px" class="sort-by">
{% if sort_by == 'like' %}
@ -72,6 +72,24 @@
</div>
</div>
{% endfor %}
<nav>
<ul class="pagination">
{%- for page in pagination.iter_pages(left_edge=2, left_current=1, right_current=3, right_edge=2) %}
{% if page %}
{% if page != pagination.page %}
<li class="page-item"><a class="page-link" href="{{ url_for('main_bp.story', story_id=story_id, page=page, per_page=pagination.per_page, key=key, sort_by=sort_by) }}">{{ page }}</a></li>
{% else %}
<li class="page-item active">
<a class="page-link" href="#">{{ page }}<span class="visually-hidden">(current)</span></a>
</li>
{% endif %}
{% else %}
<li class="page-item"><span class=ellipsis>...</span></li>
{% endif %}
{%- endfor %}
</ul>
</nav>
</div>
<div class="create-paragraph twin behind qbox part-box">

Loading…
Cancel
Save