mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
90 lines
4.1 KiB
HTML
90 lines
4.1 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}{{ database }}: {{ table }}: {% if filtered_table_rows or filtered_table_rows == 0 %}{{ "{:,}".format(filtered_table_rows) }} row{% if filtered_table_rows == 1 %}{% else %}s{% endif %}{% endif %}
|
|
{% if human_filter_description %}where {{ human_filter_description }}{% endif %}{% 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 body_class %}table db-{{ database|to_css_class }} table-{{ table|to_css_class }}{% 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 filtered_table_rows or human_filter_description %}
|
|
<h3>{% if filtered_table_rows or filtered_table_rows == 0 %}{{ "{:,}".format(filtered_table_rows) }} row{% if filtered_table_rows == 1 %}{% else %}s{% endif %}{% endif %}
|
|
{% if human_filter_description %}where {{ human_filter_description }}{% endif %}
|
|
</h3>
|
|
{% endif %}
|
|
|
|
<form class="filters" action="/{{ database }}-{{ database_hash }}/{{ table|quote_plus }}" method="get">
|
|
{% if supports_search %}
|
|
<div class="search-row"><label for="_search">Search:</label><input id="_search" type="search" name="_search" value="{{ search }}"></div>
|
|
{% endif %}
|
|
{% for column, lookup, value in filters.selections() %}
|
|
<div class="filter-row">
|
|
<div class="select-wrapper">
|
|
<select name="_filter_column_{{ loop.index }}">
|
|
<option value="">- remove filter -</option>
|
|
{% for c in filter_columns %}
|
|
<option{% if c == column %} selected{% endif %}>{{ c }}</option>
|
|
{% 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 }}" class="filter-value" value="{{ value }}">
|
|
</div>
|
|
{% endfor %}
|
|
<div class="filter-row">
|
|
<div class="select-wrapper">
|
|
<select name="_filter_column">
|
|
<option value="">- column -</option>
|
|
{% for column in filter_columns %}
|
|
<option>{{ column }}</option>
|
|
{% 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" class="filter-value">
|
|
<input type="submit" value="{% if filters.has_selections() %}Apply filters{% else %}Add filter{% endif %}">
|
|
</div>
|
|
</form>
|
|
|
|
{% if query.sql %}
|
|
<p><a class="not-underlined" title="{{ query.sql }}" href="/{{ database }}-{{ database_hash }}?{{ {'sql': query.sql}|urlencode|safe }}{% if query.params %}&{{ query.params|urlencode|safe }}{% endif %}">✎ <span class="underlined">View and edit SQL</span></a></p>
|
|
{% endif %}
|
|
|
|
<p>This data as <a href="{{ url_json }}">.json</a>, <a href="{{ url_jsono }}">.jsono</a></p>
|
|
|
|
{% include "_rows_and_columns.html" %}
|
|
|
|
{% 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 %}
|