Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F104524757
paginate_base.html
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Mar 10, 04:07
Size
3 KB
Mime Type
text/html
Expires
Wed, Mar 12, 04:07 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24803910
Attached To
R3600 invenio-infoscience
paginate_base.html
View Options
{#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#}
{# Pagination Macro
Leverages Twitter-Bootstrap paginate class and Flask-SQLAlchemy Pagination object
Args:
obj: Flask-SQLAlchemy Pagination object
endpoint: redirect enpoint
small: wheather should be rendered as small or not
Returns:
Pagination component
It assumes that page exists in the current context.
#}
{%- macro paginate(obj, small) %}
{%- set args = request.args.copy().to_dict() -%}
{%- do args.update(request.view_args.copy()) -%}
{%- set endpoint = request.endpoint -%}
<div>
<ul class="pagination {{ 'pagination-sm' if small }}">
<li {% if not obj.has_prev -%} class="disabled" {%- endif %}}>
{%- set new_args = args.copy() -%}
{%- do new_args.update({'page': 1}) -%}
<a title="first" href="{{ url_for(endpoint, **new_args) if obj.has_prev}}">«</a>
</li>
<li {% if not obj.has_prev -%} class="disabled" {%- endif %}}>
{%- do args.update({'page': obj.page-1 }) -%}
<a title="prev" href="{{ url_for(endpoint, **args) if obj.has_prev }}">‹</a>
</li>
{%- for page_p in obj.iter_pages() %}
{%- if page_p %}
{%- set new_args = args.copy() -%}
{%- do new_args.update({'page': page_p}) -%}
<li {% if page_p == obj.page -%} class="active" {%- endif %}>
<a title="current" href="{{ url_for(endpoint, **new_args) }}">{{ page_p }}</a>
</li>
{%- else %}
<li class="disabled"><a href="#">…</a></li>
{%- endif %}
{%- endfor %}
<li {% if not obj.has_next -%} class="disabled" {%- endif %}}>
{%- set new_args = args.copy() -%}
{%- do new_args.update({'page': obj.page+1}) -%}
<a title ="next" href="{{ url_for(endpoint, **new_args) if obj.has_next }}">›</a>
</li>
<li {% if not obj.has_next -%} class="disabled" {%- endif %}}>
{%- set new_args = args.copy() -%}
{%- do new_args.update({'page': obj.pages }) -%}
<a title="last" href="{{ url_for(endpoint, **new_args) if obj.has_next }}">»</a>
</li>
</ul>
</div>
{%- endmacro %}
{# List Status Indicator Macro
Args:
obj: Flask-SQLAlchemy Pagination object
Returns:
List Status Indicator component
It assumes that page and per_page exists in the current context.
#}
{%- macro list_status(obj) %}
<span class="text-muted">
{{ _("Displaying items %(start)d - %(stop)d out of %(total)d", start=(page - 1) * per_page, stop=((page - 1) * per_page) + obj.items|count, total=obj.total) }}
</span>
{%- endmacro %}
Event Timeline
Log In to Comment