Projects / snek / src / snek / templates /Â repository_file.html
git clone https://molodetz.nl/retoor/snek.git
Raw source file available here .
{% extends "app.html" %}
{% block header_text %}{{ username }}/{{ repo_name }}{% endblock %}
{% block sidebar %}{% endblock %}
{% block main %}
<div class="container">
<p>
<strong>Branch:</strong>
<select onchange="window.location.href='/repository/{{ username }}/{{ repo_name }}/{{ file_path }}?branch=' + this.value">
{% for branch in branches %}
<option value="{{ branch }}" {% if branch == current_branch %}selected{% endif %}>{{ branch }}</option>
{% endfor %}
</select>
</p>
<p>
<a href="/repository/{{ username }}/{{ repo_name }}?branch={{ current_branch }}">{{ repo_name }}</a>
{% if file_path %}
{% set parts = file_path.split('/') %}
{% set cumulative = '' %}
{% for part in parts %}
{% if cumulative %}
{% set cumulative = cumulative + '/' + part %}
{% else %}
{% set cumulative = part %}
{% endif %}
/ {% if loop.last %}<strong>{{ part }}</strong>{% else %}<a href="/repository/{{ username }}/{{ repo_name }}/{{ cumulative }}?branch={{ current_branch }}">{{ part }}</a>{% endif %}
{% endfor %}
{% endif %}
</p>
<p><strong>{{ file_name }}</strong> ({{ file_size }})</p>
{% if is_binary %}
{% if is_image %}
<img src="{{ image_data }}" alt="{{ file_name }}" style="max-width: 100%;">
{% else %}
<p>Binary file - cannot display content</p>
{% endif %}
{% else %}
<pre>{{ content }}</pre>
{% endif %}
</div>
{% endblock %}