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

            <div style="text-align: right;">

                {% if extension == 'svg' %}
                    <button class="btn btn-sm btn-primary" id="p3x-gitlist-file-svg-show">
                        <span class="fas fa-image"></span>
                        Display SVG
                    </button>
                {% endif %}

                <button class="btn btn-sm btn-danger" id="p3x-gitlist-file-delete">
                    <span class="fa fa-trash"></span>
                    Delete
                </button>

                {% embed 'modal/modal-commit.twig' with {type: 'delete', title: 'Delete', bodyTitle: 'Are you sure to delete this file?', wrapForm: true } %}
                    {% block buttons %}
                        <button id="p3x-gitlist-modal-delete-confirm" type="submit" class="btn btn-danger">
                            <span class="fa fa-trash"></span>
                            &nbsp;
                            Delete
                        </button>
                    {%  endblock %}
                {% endembed %}

                <span class="p3x-gitlist-file-svg-toggle">
                {% if (((fileType != 'image' and fileType != 'markdown' ) or (enforceCodemirror)) and not binary )%}
                    <button id="p3x-gitlist-file-button-edit" class="btn btn-sm btn-info">
                        <span class="fa fa-edit"></span> Edit
                    </button>
                    <button id="p3x-gitlist-file-button-edit-cancel" class="btn btn-sm btn-warning">
                        <i class="fas fa-eraser"></i> Cancel
                    </button>
                    <button id="p3x-gitlist-file-button-edit-save" class="btn btn-sm btn-info">
                        <span class="fa fa-save"></span> Save
                    </button>

                    {% embed 'modal/modal-commit.twig' with { type: 'commit', title: 'Commit', bodyTitle: 'Are you sure to commit this change?', wrapForm: true } %}
                    {% block buttons %}
                        <button id="p3x-gitlist-modal-commit-push" type="submit" class="btn btn-info">
                            <span class="fas fa-caret-right"></span>
                            &nbsp;
                            Save
                        </button>
                    {%  endblock %}

                {% endembed %}

                {% elseif fileType == 'markdown' %}
                    <a href="{{ path('blob', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}?codemirror=1&edit=1"
                       class="btn btn-sm btn-info">
                        <span class="fa fa-edit"></span> Edit
                    </a>
                {% endif %}


                </span>


            </div>

        {% endblock %}

        {% block left %}

            <div class="p3x-gitlist-button">

                {% if binary %}
                    <a href="{{ path('blob_raw', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}"
                       class="btn btn-info btn-sm"><span class="fas fa-download"></span> Download</a>
                {% else %}
                <a href="{{ path('blob_raw', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}"
                       class="btn btn-info btn-sm"><span class="fas fa-download"></span> Raw</a>
                {% endif %}
                <a href="{{ path('blame', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}"
                   class="btn btn-default btn-sm"><span class="fa fa-fire"></span> Blame</a>
                <a href="{{ path('commits', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}"
                   class="btn btn-default btn-sm"><i class="fas fa-history"></i> History</a>

                <div class="p3x-gitlist-file-svg-toggle">

               {% if (((fileType != 'image' and fileType != 'markdown') or enforceCodemirror) and not binary) %}
                    <span id="p3x-gitlist-file-codemirror" style="display: none;">
                        <div class="btn-group btn-toggle">
                            <button id="p3x-gitlist-file-button-scroll" class="btn btn-sm btn-default">Scroll mode</button>
                            <button id="p3x-gitlist-file-button-full" class="btn btn-sm btn-default">Full height</button>
                        </div>
                    </span>

                {% endif %}

                {% if fileType == 'markdown' %}

                    {% if enforceCodemirror %}
                        <a href="{{ path('blob', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}"
                           class="btn btn-default btn-sm"><span class="fa fa-code"></span> Markdown rendered</a>
                    {% else %}
                        <a title="Click this button and you can edit/save this code."
                           href="{{ path('blob', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}?codemirror=1"
                           class="btn btn-default btn-sm"><span class="fa fa-code"></span> Markdown code</a>
                    {% endif %}


                {% endif %}

                </div>



            </div>

        {% endblock %}

    {% endembed %}

    <div id="p3x-gitlist-file-codemirror-exceeded" role="alert" class="alert-dismissable alert alert-info">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        This file ( {{ fileSize | format_size }} ) exceeds the allowed full mode ({{ codemirror_full_limit }} kb) size. The editor full hight is disabled, only scrolling is allowed..
    </div>



    <div>

        {% if fileType == 'image' %}
            <div class="text-center"><img style="max-width: 100%; max-height: auto;" src="{{ path('blob_raw', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}"
                                          alt="{{ file }}" class="image-blob"/></div>

        {% elseif fileType == 'markdown' and enforceCodemirror != true %}
            {% include 'markdown.twig' with {'filename': file, 'data': blob} %}
        {% elseif not binary %}
            <pre class="p3x-gitlist-code" id="p3x-gitlist-file-editor" language="{{ fileType }}">{{ blob|htmlentities|raw }}</pre>
        {% endif %}

        {% if extension == 'svg' %}
            <div id="p3x-gitlist-file-svg-content" style="display: none;" class="p3x-gitlist-file-svg-toggle p3x-gitlist-max-width"></div>
        {% endif %}
    </div>



{% endblock %}