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

{% block section %}
	{% if view.mbd_scandir %}
		{% mbd_token as table_id %}
		<table id="{{ table_id }}">
			{% mbd_datatable table_id order='[1, "asc"]' %}
			<thead>
				<tr>
					<th>Type</th>
					<th>Name</th>
					<th>Size</th>
					<th>Modified</th>
				</tr>
			</thead>
			<tbody>
				{% for direntry in view.mbd_scandir %}
					{% with typ=direntry.is_dir|yesno:"places/folder,mimetypes/text-x-generic" apx=direntry.is_dir|yesno:"/," mtime=direntry.stat.st_mtime|mbd_fromtimestamp %}
						<tr>
							<td>
								<img class="mbd-icon" src="{% static 'icons/'|add:typ|add:'.svg' %}" alt="{{ typ }}">
							</td>
							<td>
								<a href="{% mbd_join request.path direntry.name %}{{ apx }}"><code>{{ direntry.name }}{{ apx }}</code></a>
							</td>
							<td>
								{{ direntry.stat.st_size }}
							</td>
							<td data-order="{{ mtime|date:"U:u" }}">
								{{ mtime|date:"r" }}
							</td>
						</tr>
					{% endwith %}
				{% endfor %}
			</tbody>
		</table>
	{% else %}
		{% mbd_file file_path=view.mbd_fullpath uri=view.mbd_static_uri %}
	{% endif %}
{% endblock %}
