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

{% set page = 'files' %}

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

{% block content %}
    {% include 'breadcrumb.twig' with {breadcrumbs: breadcrumbs} %}

    <span ng-controller="file">
    <div class="pull-right p3x-gitlist-twig-file-button-row">
        <div class="btn-group">
            <a href="{{ path('blob_raw', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}"
               class="btn btn-primary btn-sm"><span class="fa fa-file-text-o"></span> Raw</a>
            <a href="{{ path('blame', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}"
               class="btn btn-primary btn-sm"><span class="fa fa-bullhorn"></span> Blame</a>
            <a href="{{ path('commits', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}"
               class="btn btn-primary btn-sm"><span class="fa fa-list"></span> History</a>
        </div>

        {% if (fileType != 'image' and fileType != 'markdown') or (enforceCodemirror) %}
        <div class="">
            <button id="p3x-gitlist-file-button-edit" class="btn btn-sm btn-primary">
                <span class="fa fa-edit"></span> Edit
            </button>
            <button id="p3x-gitlist-file-button-edit-save" class="btn btn-sm btn-primary">
                <span class="fa fa-save"></span> Save
            </button>
            <button id="p3x-gitlist-file-button-edit-cancel" class="btn btn-sm btn-primary">
                <span class="fa fa-close"></span> Cancel
            </button>
        </div>
        {%  elseif fileType == 'markdown' %}
        <a href="{{ path('blob', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}?codemirror=1&edit=1" class="btn btn-sm btn-primary">
            <span class="fa fa-edit"></span> Edit
        </a>
        {% endif %}

    </div>

    <div class="pull-left p3x-gitlist-twig-file-button-row">

    {% if fileType == 'markdown' %}

        {% if enforceCodemirror %}
            <a href="{{ path('blob', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}"
               class="btn btn-primary 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-primary btn-sm"><span class="fa fa-code"></span> Markdown code</a>
        {% endif %}


    {% endif %}

        {% if (fileType != 'image' and fileType != 'markdown') or enforceCodemirror %}
            <div id="p3x-gitlist-file-small" style="display: none;">
                <button id="p3x-gitlist-file-small-button" class="btn btn-sm btn-primary">Parse code</button>
            </div>

            <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-primary">Scroll mode</button>
                    <button id="p3x-gitlist-file-button-full" class="btn btn-sm btn-primary">Full height</button>
                </div>
            </span>

        {% endif %}

    </div>

    <div style="clear: both;"></div>

    <div class="source-view">

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

        {% elseif fileType == 'markdown' and enforceCodemirror != true %}
            <div class="md-view"><div id="md-content">{{ blob }}</div></div>

        {% else %}
            <pre id="sourcecode" language="{{ fileType }}">{{ blob|htmlentities|raw }}</pre>
        {% endif %}
    </div>
    </span>



{% endblock %}