{% extends "mini_buildd/base.html" %}
{% block title %}{% block titledup %}{{ route|title }} dir: /{{ path }}{% endblock %}{% endblock %}
{% block tooltip %}Directory Listing{% endblock %}

{% block content %}
	{% if view.mbd_scandir %}
		{% mbd_token as table_id %}
		<table id="{{ table_id }}" style="width: 100%;">
			{% mbd_datatable table_id order='[0, "asc"]' %}
			<thead>
				<tr>
					<th>Name</th>
					<th>Size</th>
					<th>Modified</th>
				</tr>
			</thead>
			<tbody>
				{% for direntry in view.mbd_scandir %}
					<tr>
						<td>
							{% if direntry.is_dir %}
								<img class="mbd-icon" src="{% static 'icons/'|add:'folder.svg' %}" alt="Dir">
								<a href="{% mbd_join request.path direntry.name %}" title="Browse {{ direntry.name }}"><code>{{ direntry.name }}</code></a>
							{% else %}
								<img class="mbd-icon" src="{% static 'icons/'|add:'file.svg' %}" alt="File">
								<a href="{% mbd_join view.mbd_static_uri direntry.name %}" title="Download {{ direntry.name }}"><code>{{ direntry.name }}</code></a>
								<a class="mbd-icon" href="{% mbd_join request.path direntry.name %}" title="Details of {{ direntry.name }}"><img class="mbd-icon" src="{% static 'icons/'|add:'details.svg' %}" alt="Details"></a>
							{% endif %}
						</td>
						<td>{{ direntry.stat.st_size }}</td>
						{% with mtime=direntry.stat.st_mtime|mbd_fromtimestamp %}
							<td class="mbd-localize-date" title="{{ mtime|date:"r" }}" data-order="{{ mtime|date:"U:u" }}">
								{{ mtime|date:"r" }}
							</td>
						{% endwith %}
					</tr>
				{% endfor %}
			</tbody>
		</table>
	{% else %}
		{% mbd_file file_path=view.mbd_fullpath uri=view.mbd_static_uri %}
	{% endif %}
{% endblock %}
