{% load i18n %}
{% load permissions %}
{% load translations %}
{% load icons %}

{% perm 'vcs.view' object as user_can_see_git_repository %}

{% if user_can_see_git_repository %}
<tr>
<th>{% trans "Repository" %}</th>
<td colspan="2">
    <code class="git-repo ui-corner-all">{{ object.get_repo_url }}</code>
    <button type="button" class="btn btn-link btn-xs" data-clipboard-text="{{ object.get_repo_url }}" title="{% trans "Copy to clipboard" %}">{% icon "copy.svg" %}</button>
</td>
</tr>

<tr>
<th>{% trans "Repository branch" %}</th>
<td colspan="2">
{{ object.get_repo_branch }}
</td>
</tr>

{% with object.get_last_remote_commit as commit %}
<tr>
<th>{% trans "Last remote commit" %}</th>
<td colspan="2">
    {{ commit.summary }} 
    <code title="{{ commit.revision }}">{{ commit.shortrevision }}</code>
    <button type="button" class="btn btn-link btn-xs" data-clipboard-text="{{ commit.revision }}" title="{% trans "Copy to clipboard" %}">{% icon "copy.svg" %}</button>
    <br />
{% comment %}Translators: For example: "nijel authored five days ago"{% endcomment %}
{% blocktrans with author=commit|format_commit_author date=commit.authordate|naturaltime %}{{ author }} authored {{ date }}{% endblocktrans %}<br />
</td>
</tr>
{% endwith %}

{% with object.get_export_url as export_url %}
{% if export_url %}
<tr>
<th>{% trans "Repository containing Weblate translations" %}</th>
<td colspan="2">
    <code class="git-repo ui-corner-all">{{ export_url }}</code>
    <button type="button" class="btn btn-link btn-xs" data-clipboard-text="{{ export_url }}" title="{% trans "Copy to clipboard" %}">{% icon "copy.svg" %}</button>
</td>
</tr>
{% endif %}
{% endwith %}
{% endif %}
