RSS Git Download  Clone
Raw Blame History
{% extends 'layout_page.twig' %}

{% set page = 'files' %}

{% block title %}GitList{% endblock %}

{% block content %}
    {% embed 'breadcrumb.twig' with {breadcrumbs: breadcrumbs} %}
        {% block extra %}
            <div class="pull-right">
                <div class="btn-group download-buttons">
                    {% if show_http_remote or show_ssh_remote %}
                    <a type="button" href="#" class="btn btn-default btn-xs" title="Show remotes to clone this repository." id="clone-button-show">Clone</a>
                    {% endif %}
                    <a type="button" href="{{ path('archive', {repo: repo, branch: branch, format: 'zip'}) }}" class="btn btn-default btn-xs" title="Download '{{ branch }}' as a ZIP archive">ZIP</a>
                    <a type="button" href="{{ path('archive', {repo: repo, branch: branch, format: 'tar'}) }}" class="btn btn-default btn-xs" title="Download '{{ branch }}' as a TAR archive">TAR</a>
                </div>
		        <div class="download-buttons rss-button">
		            <a href="{{ path('rss', {repo: repo, branch: branch}) }}"><span class="fa fa-rss rss-icon"></span></a>
		        </div>
            </div>
            {% if show_http_remote or show_ssh_remote %}
            <div id="clone-popup">
                <div id="clone-popup-inner-wrapper">
                    <a class="close" href="#" id="clone-button-hide">&times;</a>
                    <div class="btn-group">
                        {% if show_ssh_remote %}
                        <button type="button" class="btn btn-default{{ show_ssh_remote and show_http_remote ? ' active' }}" id="clone-button-ssh">SSH</button>
                        {% endif %}
                        {% if show_http_remote %}
                        <button type="button" class="btn btn-default" id="clone-button-http">HTTP{{ use_https ? 'S' }}</button>
                        {% endif %}
                    </div><br />
                    {% if show_ssh_remote %}
                    <input type="text" class="form-control{{ show_ssh_remote ? ' visible' }}" id="clone-input-ssh" value="git clone {{ ssh_user }}{{ ssh_user ? '@' }}{{ ssh_host ? ssh_host : global.request.host }}:{{ ssh_url_subdir }}{{ repo }}">
                    {% endif %}
                    {% if show_http_remote %}
                    <input type="text" class="form-control{{ show_ssh_remote is empty and show_http_remote ? ' visible' }}" id="clone-input-http" value="git clone http{{ use_https ? 's' }}://{{ http_user }}{{ http_user ? '@' }}{{ http_host ? http_host : global.request.host }}/{{ http_url_subdir }}{{ repo }}">
                    {% endif %}
                </div>
            </div>
            {% endif %}
        {% endblock %}
    {% endembed %}

    {% if files is not empty %}
    <div class="table-border">
    <table class="table tree">
        <thead>
            <tr>
                <th>Name</th>
                <th>Mode</th>
                <th>Size</th>
            </tr>
        </thead>
        <tbody>
            {% if parent is not null %}
            <tr>
                <td>
                    {% if not parent %}
                        <a href="{{ path('branch', {repo: repo, branch: branch}) }}">..</a>
                    {% else %}
                        <a href="{{ path('tree', {repo: repo, commitishPath: branch ~ '/' ~ parent}) }}">..</a>
                    {% endif %}
                </td>
                <td></td>
                <td></td>
            </tr>
            {% endif %}
            {% for file in files %}
            <tr>
                <td><span class="fa {{ file.type == "folder" or file.type == "symlink" ? "fa-folder-open" : "fa-file-text-o" }}"></span> <a href="
                    {%- if file.type == "folder" or file.type == "symlink" -%}
                        {{ path('tree', {repo: repo, commitishPath: branch ~ '/' ~ path ~ (file.type == "symlink" ? file.path : file.name)}) }}
                    {%- else -%}
                        {{ path('blob', {repo: repo, commitishPath: branch ~ '/' ~ path ~ (file.type == "symlink" ? file.path : file.name)}) }}
                    {%- endif -%}
                ">{{ file.name }}</a></td>
                <td>{{ file.mode }}</td>
                <td>{% if file.size %}{{ (file.size / 1024) | number_format }} kb{% endif %}</td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
    </div>
    {% else %}
        <p>This repository is empty.</p>
    {% endif %}
    {% if readme is defined and readme is not empty %}
        <div class="readme-view">
            <div class="md-header">
                <span class="meta">{{ readme.filename }}</span>
            </div>
            <div id="md-content">{{ readme.content }}</div>
        </div>
    {% endif %}

    <hr />
{% endblock %}