Skip to content
Snippets Groups Projects
Commit 84fc5b0b authored by Jonas Haag's avatar Jonas Haag
Browse files

Implemented history pagination.

parent 5feae5c1
No related branches found
No related tags found
No related merge requests found
......@@ -3,11 +3,18 @@
{% block content %}
{% from 'history.inc.html' import history %}
{% call history(repo, path, max_length=30, skip=30*page) %}
{% call(have_more_commits) history(repo, path, max_length=30, skip=30*page) %}
<div class=pagination>
<a href="{{ urls.prev }}" {% if page == 1%}class=inactive{% endif %}>
« newer</a>
<a href="{{ urls.next }}">» older</a>
{% if page %}
<a href="{{ urls.prev }}">« newer</a>
{% else %}
<a href=# class=inactive>« newer</a>
{% endif %}
{% if have_more_commits %}
<a href="{{ urls.next }}">» older</a>
{% else %}
<a href=# class=inactive>» older</a>
{% endif%}
</div>
{% endcall %}
......
{% macro history(repo, path, max_length, skip=0) %}
<div class=history>
{% set history = repo.history(max_commits=max_length+1, path=path, skip=skip) %}
<ul>
{% for commit in repo.history(max_commits=max_length, path=path, skip=skip) %}
{% for commit in history %}
{% if not loop.last or history|length < max_length %}
<li>
<span class=id>
<a href="{{ build_url('view_commit', repo=repo.name, id=commit.id) }}">
......@@ -11,8 +13,9 @@
<span class=message>{{ commit.message.decode('utf-8')|shorten_message }}</span>
<span class=datetime>{{ commit.commit_time|timesince }} ago</span>
</li>
{% endif %}
{% endfor %}
</ul>
{% if caller %}{{ caller() }}{% endif %}
{% if caller %}{{ caller(history|length == max_length+1) }}{% endif %}
</div>
{% endmacro %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment