Page MenuHomec4science

cloudutils_macros.html
No OneTemporary

File Metadata

Created
Mon, Dec 2, 06:15

cloudutils_macros.html

{#
## This file is part of Invenio.
## Copyright (C) 2013 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.
#}
{% macro menu( active = "service") -%}
<ul class="nav nav-pills nav-stacked">
<li {{("", "class=active")[active == "service"]}}><a href="{{ url_for('cloudutils.about') }}" >About</a></li>
<li {{("", "class=active")[active == "dropbox"]}}><a href="{{ url_for('cloudutils.index', service='dropbox') }}">DropBox</a></li>
<li {{("", "class=active")[active == "google_drive"]}}><a href="{{ url_for('cloudutils.index', service='google_drive') }}">Google Drive</a></li>
<li {{("", "class=active")[active == "skydrive"]}}><a href="{{ url_for('cloudutils.index', service='skydrive') }}">SkyDrive</a></li>
</ul>
{%- endmacro %}
{% macro pagination( request, number_of_pages = 1, current_page = 1 ) -%}
<div class="pagination pagination-centered">
<ul>
{% if not request.args -%}
{% for index in range(number_of_pages) -%}
<li {{("", "class=active")[(index+1) == current_page]}} ><a href="{{request.url + '?page='}}{{index+1}}">{{index+1}}</a></li>
{% endfor %}
{% elif not request.args.has_key('page') -%}
{% for index in range(number_of_pages) -%}
<li {{("", "class=active")[(index+1) == current_page]}} ><a href="{{request.url + '&page='}}{{index+1}}">{{index+1}}</a></li>
{% endfor %}
{% else -%}
{%- set url = request.url -%}
{%- set target = 'page=' -%}
{%- set position = url.rfind(target) + target|length -%}
{%- set url = url[0:position] + url[position+request.args["page"]|length:] -%}
{% for index in range(number_of_pages) -%}
{%- set replacement = "page=" -%}
<li {{("", "class=active")[(index+1) == current_page]}} ><a href="{{ replacement.join(url.rsplit(target, 1)) }}{{index+1}}">{{index+1}}</a></li>
{% endfor %}
{% endif %}
</ul>
</div>
{%- endmacro %}

Event Timeline