RSS Git Download  Clone
Raw Blame History
{% extends 'layout-page.twig' %}

{% set page = 'files' %}

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


{% block content %}

    {% embed 'breadcrumb.twig' with {breadcrumbs: breadcrumbs } %}
        {% block left %}
            <div class="p3x-gitlist-button">
                <button class="btn btn-sm btn-info" onclick="alert('in progress');">
                    <i class="far fa-file-alt"></i> New file
                </button>
                <button class="btn btn-sm btn-info" onclick="alert('in progress');">
                    <i class="far fa-file"></i> Upload binary
                </button>


            </div>
        {%  endblock %}

    {% endembed %}

    {% if files is not empty %}
        <table class="table table-striped" id="p3x-gitlist-tree-table">
            <thead>
            <tr>
                <th width="80%">Name</th>
                <th width="10%" style="text-align: right;">Mode</th>
                <th width="10%" style="text-align: right;">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>
                        {%- if file.type == "folder" or file.type == "symlink" -%}
                            <span class="fas fa-folder"></span>
                            &nbsp;
                            <a href="{{ path('tree', {repo: repo, commitishPath: branch ~ '/' ~ path ~ (file.type == "symlink" ? file.path : file.name)}) }}">{{ file.name }}</a>

                        {%- elseif file.type == "module" -%}
                            <span class="fas fa-folder-open"></span>
                            &nbsp;
                            <a title="Head: {{ head }}" href="{{ file.url }}/tree/{{ head }}">{{ file.name }}</a>
                            @
                            <a title="Commit: {{ file.hash }}"
                               href="{{ file.url }}/tree/{{ file.hash }}">{{ file.shortHash }}</a>

                        {%- else -%}
                            <span class="far fa-file-alt"></span>
                            &nbsp;
                            <a href="{{ path('blob', {repo: repo, commitishPath: branch ~ '/' ~ path ~ (file.type == "symlink" ? file.path : file.name)}) }}">{{ file.name }}</a>

                        {%- endif -%}
                        </a>


                    </td>
                    <td style="text-align: right;">{{ file.mode }}</td>
                    <td style="text-align: right;">{% if file.size %}{{ (file.size / 1024) | number_format }} kb{% endif %}</td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    {% else %}
        <p>This repository is empty.</p>
    {% endif %}
    {% if readme is defined and readme is not empty %}
        {% include 'markdown.twig' with {'filename': readme.filename, 'data': readme.content} %}
    {% endif %}


{% endblock %}