{% extends 'layout_page.twig' %} {% set page = 'files' %} {% block title %}P3X GitList{% endblock %} {% block content %} {% include 'breadcrumb.twig' with {breadcrumbs: breadcrumbs} %} <script type="text/javascript"> window.gitlist.codemirror_full_limit = parseInt({{ codemirror_full_limit }}); </script> <div class="p3x-gitlist-breadcrumb-divider"></div> <div class="pull-right p3x-gitlist-twig-file-button-row"> <a href="{{ path('blob_raw', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}" class="btn btn-primary btn-sm"><span class="fas fa-download"></span> Raw</a> <a href="{{ path('blame', {repo: repo, commitishPath: branch ~ '/' ~ file}) }}" class="btn btn-primary btn-sm"><span class="fa fa-fire"></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> {% if (fileType != 'image' and fileType != 'markdown') or (enforceCodemirror) %} <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-cancel" class="btn btn-sm btn-primary"> <span class="fa fa-ban"></span> Cancel </button> <button id="p3x-gitlist-file-button-edit-save" class="btn btn-sm btn-primary"> <span class="fa fa-save"></span> Save </button> {% 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 %} <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> <h6 id="p3x-gitlist-file-codemirror-exceeded" style="display: none;"> {{ (fileSize / 1024) | number_format }} kb of {{ codemirror_full_limit }} kb allowed </h6> {% 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> {% endblock %}