pagure-new/pagure/templates/commits.html

200 lines
7 KiB
HTML
Raw Normal View History

2016-09-21 23:21:07 +00:00
{% extends "repo_master.html" %}
{% block title %}{{ select.capitalize() }} - {{
repo.namespace + '/' if repo.namespace }}{{ repo.name }}{% endblock %}
{% set tag = "home" %}
{% block repo %}
<div class="row m-b-1">
{% if g.repo_obj and g.repo_obj.is_empty %}
<div class="col-md-12">
<div class="alert alert-info" role="alert">
<p>This repo is brand new!</p>
<p>There are no commits to this project yet</p>
</div>
</div>
{% else %}
<div class="col-sm-6">
<h3>
Commits <span class="label label-default"> {{number_of_commits}}</span>
</h3>
</div>
<div class="col-sm-6">
<div class="pull-xs-right">
<div class="button-label button-label-default">
{% if repo.is_fork %}
<span class="oi" data-glyph="fork"></span>
{{ repo.user.user }}/{{ repo.name }}
{% else %}
<span class="oi" data-glyph="document"></span> {{ repo.name }}
{% endif %}
</div>
{% if branchname %}
<div class="btn-group">
<button type="button" class="btn btn-secondary btn-sm dropdown-toggle"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="oi" data-glyph="random"> </span> {{ branchname }}
</button>
<div class="dropdown-menu dropdown-menu-right">
{% for branch in g.branches %}
<a class="dropdown-item" href="{{ url_for(
'view_commits',
repo=repo.name,
username=username,
namespace=repo.namespace,
branchname=branch) }}">
{{ branch }}
</a>
{% endfor %}
</div>
</div>
{% endif %}
</div>
</div>
</div>
{% if diff_commits|count > 0 %}
<div class="alert alert-info" role="alert">
This branch contains <a href="#" id="diff_commits_link">
{{ diff_commits|count }} commits</a> not in
{% if repo.is_fork %}
the upstream project
<span class="pr-toplabel">
<span class="oi" data-glyph="document"></span>
{{ repo.name }}
</span>
{% else %}
the main branch
{% endif %}
<span class="pr-toplabel">
<span class="oi" data-glyph="random"> </span>
{{head}}
</span>
{% if diff_commits and authenticated and
(repo.is_fork or repo.settings.get('pull_requests', True)) %}
<div id="request_pull" class="pull-xs-right">
<a class="btn btn-primary btn-sm"
href="{{ url_for('new_request_pull',
repo=repo.name,
username=username,
namespace=repo.namespace,
branch_to=head, branch_from=branchname or 'master') }}">
{% if g.repo_admin %}Request pull{% else %}Compare{% endif %}
</a>
</div>
{% endif %}
<div id="diff_commits" class="list-group m-t-1" style="display:none;">
{% for diff_commit_full in diff_commits_full %}
<a href="{{ url_for('view_commit',
repo=repo.name,
username=username,
namespace=repo.namespace,
commitid=diff_commit_full.hex)
}}" class="list-group-item">
<h5>
<strong>{{ diff_commit_full.message.split('\n')[0] }}</strong>
<div class="pull-xs-right">
<span class="commitdate"
title="{{ diff_commit_full.commit_time|format_ts }}">
{{ diff_commit_full.commit_time|humanize }}
</span>
</div>
</h5>
{{ diff_commit_full.author | author2avatar(20) | safe }}
{{ diff_commit_full.author.name }}
<div class="pull-xs-right">
<span class="label label-default">
{{ diff_commit_full.hex|short }}
</span>
</div>
</a>
{% endfor %}
</div>
</div>
{% endif %}
<div class="list-group m-t-1">
{% for commit in last_commits %}
<a href="{{ url_for('view_commit',
repo=repo.name,
username=username,
namespace=repo.namespace,
commitid=commit.hex, branch=branchname) }}"
class="list-group-item {%
if diff_commits and commit.oid.hex in diff_commits %}p-l-3{%
endif %}" style="position:relative;">
{% if diff_commits and commit.oid.hex in diff_commits %}
<div title="This commit is not in the main branch of this Repo"
style="position:absolute; left:0; top:0; padding:5px;
padding-top:20px; height:100%; background:#eee;
vertical-align:middle;">
<span class="oi" data-glyph="arrow-thick-right"></span>
</div>
{% endif %}
<h5>
<strong>{{ commit.message.split('\n')[0] }}</strong>
<div class="pull-xs-right">
<span class="commitdate"
title="{{ commit.commit_time|format_ts }}">
{{ commit.commit_time|humanize }}
</span>
</div>
</h5>
{{ commit.author | author2avatar(20) | safe }} {{ commit.author.name }}
<div class="pull-xs-right">
<span class="label label-default">{{ commit.hex|short }}</span>
</div>
</a>
{% endfor %}
</div>
{% if total_page %}
<nav class="text-center">
<ul class="pagination">
<li {% if page <= 1%} class="disabled" {% endif %}>
<a href="{{ url_for('.%s' % origin,
repo=repo.name,
username=username,
namespace=repo.namespace,
branchname=branchname,
page=page-1)
}}" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
<span class="sr-only">Newer</span>
</a>
</li>
<li class="active">page {{ page }} of {{total_page}}</li>
<li {% if page >= total_page %}class="disabled"{%endif%}>
<a href="{{ url_for('.%s' % origin,
repo=repo.name,
username=username,
namespace=repo.namespace,
branchname=branchname,
page=page+1)
}}" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
<span class="sr-only">Older</span>
</a>
</li>
</ul>
</nav>
{% endif %}
{% endif %}
</div>
{% endblock %}
{% block jscripts %}
{{ super() }}
<script type="text/javascript">
$(function(){
$('#diff_commits_link').click(function(){
$('#diff_commits').toggle();
});
});
</script>
{% endblock %}