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 type="button" class="btn btn-sm btn-info" id="p3x-gitlist-tree-new-file">
                    <i class="far fa-file-alt"></i> New file or directory
                </button>

                {% embed 'modal/modal-commit.twig' with {type: 'new', title: 'New file', bodyTitle: 'Are you sure to add a new file or directory?<br/><strong>If you add a slash to the end of the "filename", you create a directory, otherwise you create a file. <br/>Please, make sure you use a relative path.</strong>', wrapForm: true } %}
                    {% block form %}

                        <div class="input-group">
                                            <span class="input-group-addon" id="p3x-gitlist-modal-{{ type }}-filename-aria"><i
                                                        class="far fa-file-alt"></i></span>
                            <input required type="text" class="form-control" placeholder="New filename or directory"
                                   aria-describedby="p3x-gitlist-modal-{{ type }}-filename-aria"
                                   id="p3x-gitlist-modal-{{ type }}-filename" minlength="1" maxlength="128"
                                   value="">
                        </div>
                        <br/>
                    {%  endblock %}
                    {% block buttons %}


                        <button id="p3x-gitlist-modal-new-filename-confirm" type="submit" class="btn btn-info">
                            <span class="far fa-file-alt"></span>
                            New file or directory
                        </button>
                    {%  endblock %}
                {% endembed %}



                <button type="button"  class="btn btn-sm btn-info"  id="p3x-gitlist-tree-new-binary">
                    <i class="far fa-file"></i> Upload file and/or override/binary
                </button>

                {% embed 'modal/modal-commit.twig' with {enctype: 'multipart/form-data', type: 'new-binary', title: 'New binary', bodyTitle: 'Are you sure to add a new binary file?', wrapForm: true } %}
                    {% block form %}
                        <div class="input-group">

                            <input required type="file" class="form-control-file" placeholder="New binary filename"
                                   aria-describedby="p3x-gitlist-modal-{{ type }}-filename-binary-upload-aria"
                                   id="p3x-gitlist-modal-{{ type }}-filename-binary-upload">
                        </div>
                        <div class="checkbox">
                            <label><input id="p3x-gitlist-modal-{{ type }}-filename-binary-override" type="checkbox" value="1">Allow override existing</label>
                        </div>

                        <div class="input-group">
                                            <span class="input-group-addon" id="p3x-gitlist-modal-{{ type }}-filename-binary-aria"><i
                                                        class="far fa-file"></i></span>
                            <input required type="text" class="form-control" placeholder="New binary filename"
                                   aria-describedby="p3x-gitlist-modal-{{ type }}-filename-binary-aria"
                                   id="p3x-gitlist-modal-{{ type }}-filename-binary" minlength="1" maxlength="128"
                                   value="">
                        </div>
                        <br/>



                    {%  endblock %}
                    {% block buttons %}

                        <button id="p3x-gitlist-modal-new-filename-binary-confirm" type="submit" class="btn btn-info">
                            <span class="far fa-file"></span>
                            Upload file and/or override/binary
                        </button>

                    {%  endblock %}
                {% endembed %}

            </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 %}