mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
113 lines
4.1 KiB
HTML
113 lines
4.1 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}{{ database }}: {{ table }}{% endblock %}
|
|
|
|
{% block extra_head %}
|
|
<style>
|
|
@media only screen and (max-width: 576px) {
|
|
{% for column in display_columns %}
|
|
td:nth-of-type({{ loop.index }}):before { content: "{{ column|escape_css_string }}"; }
|
|
{% endfor %}
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="hd"><a href="/">home</a> / <a href="/{{ database }}-{{ database_hash }}">{{ database }}</a></div>
|
|
|
|
<h1 style="padding-left: 10px; border-left: 10px solid #{{ database_hash[:6] }}">{{ table }}{% if is_view %} (view){% endif %}</h1>
|
|
|
|
{% if table_rows != None %}
|
|
<h2>{{ "{:,}".format(table_rows) }} total row{% if table_rows == 1 %}{% else %}s{% endif %} in this table</h2>
|
|
{% endif %}
|
|
|
|
<p>{{ human_filter_description }}</p>
|
|
|
|
{% if supports_search %}
|
|
<form action="/{{ database }}-{{ database_hash }}/{{ table|quote_plus }}" method="get">
|
|
<p><input type="search" name="_search" value="{{ search }}"> <input type="submit" value="Search"></p>
|
|
</form>
|
|
{% endif %}
|
|
|
|
<form class="filters" action="/{{ database }}-{{ database_hash }}/{{ table|quote_plus }}" method="get">
|
|
{% for column, lookup, value in filters.selections() %}
|
|
<div class="filter-row">
|
|
<div class="select-wrapper">
|
|
<select name="_filter_column_{{ loop.index }}">
|
|
{% for c in display_columns %}
|
|
{% if c != 'rowid' %}
|
|
<option{% if c == column %} selected{% endif %}>{{ c }}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="select-wrapper filter-op">
|
|
<select name="_filter_op_{{ loop.index }}">
|
|
{% for key, display, no_argument in filters.lookups() %}
|
|
<option value="{{ key }}{% if no_argument %}__1{% endif %}"{% if key == lookup %} selected{% endif %}>{{ display }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<input type="text" name="_filter_value_{{ loop.index }}" style="width: 200px" value="{{ value }}">
|
|
</div>
|
|
{% endfor %}
|
|
<div class="filter-row">
|
|
<div class="select-wrapper">
|
|
<select name="_filter_column">
|
|
<option value="">- pick a column -</option>
|
|
{% for column in display_columns %}
|
|
{% if column != 'rowid' %}
|
|
<option>{{ column }}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class="select-wrapper filter-op">
|
|
<select name="_filter_op">
|
|
{% for key, display, no_argument in filters.lookups() %}
|
|
<option value="{{ key }}{% if no_argument %}__1{% endif %}"{% if key == lookup %} selected{% endif %}>{{ display }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<input type="text" name="_filter_value" style="width: 200px">
|
|
<input type="submit" value="{% if filters.has_selections() %}Apply filters{% else %}Add filter{% endif %}">
|
|
</div>
|
|
</form>
|
|
|
|
<pre>{{ query.sql }}</pre>
|
|
{% if query.params %}<pre>params = {{ query.params|tojson(4) }}</pre>{% endif %}
|
|
|
|
<p>This data as <a href="{{ url_json }}">.json</a>, <a href="{{ url_jsono }}">.jsono</a></p>
|
|
|
|
<p>Returned {% if truncated %}more than {% endif %}{{ "{:,}".format(display_rows|length) }} row{% if display_rows|length == 1 %}{% else %}s{% endif %}</p>
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
{% for column in display_columns %}<th scope="col">{{ column }}</th>{% endfor %}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for row in display_rows %}
|
|
<tr>
|
|
{% for cell in row %}
|
|
<td>{{ cell.value }}</td>
|
|
{% endfor %}
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
|
|
{% if next_url %}
|
|
<p><a href="{{ next_url }}">Next page</a></p>
|
|
{% endif %}
|
|
|
|
{% if table_definition %}
|
|
<pre>{{ table_definition }}</pre>
|
|
{% endif %}
|
|
|
|
{% if view_definition %}
|
|
<pre>{{ view_definition }}</pre>
|
|
{% endif %}
|
|
|
|
{% endblock %}
|