kopia lustrzana https://github.com/simonw/datasette
168 wiersze
8.1 KiB
HTML
168 wiersze
8.1 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}{{ database }}: {{ table }}: {% if filtered_table_rows_count or filtered_table_rows_count == 0 %}{{ "{:,}".format(filtered_table_rows_count) }} row{% if filtered_table_rows_count == 1 %}{% else %}s{% endif %}{% endif %}
|
|
{% if human_description_en %}where {{ human_description_en }}{% endif %}{% endblock %}
|
|
|
|
{% block extra_head %}
|
|
{{ super() }}
|
|
<style>
|
|
@media only screen and (max-width: 576px) {
|
|
{% for column in display_columns %}
|
|
.rows-and-columns td:nth-of-type({{ loop.index }}):before { content: "{{ column.name|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="{{ prefix }}">home</a> / <a href="{{ prefix }}{{ database }}-{{ database_hash }}">{{ database }}</a></div>
|
|
|
|
<h1 style="padding-left: 10px; border-left: 10px solid #{{ database_hash[:6] }}">{{ metadata.title or table }}{% if is_view %} (view){% endif %}</h1>
|
|
|
|
{% block description_source_license %}{% include "_description_source_license.html" %}{% endblock %}
|
|
|
|
{% if filtered_table_rows_count or human_description_en %}
|
|
<h3>{% if filtered_table_rows_count or filtered_table_rows_count == 0 %}{{ "{:,}".format(filtered_table_rows_count) }} row{% if filtered_table_rows_count == 1 %}{% else %}s{% endif %}{% endif %}
|
|
{% if human_description_en %}{{ human_description_en }}{% endif %}
|
|
</h3>
|
|
{% endif %}
|
|
|
|
<form class="filters" action="{{ prefix }}{{ 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">
|
|
</div>
|
|
<div class="filter-row">
|
|
{% if is_sortable %}
|
|
<div class="select-wrapper small-screen-only">
|
|
<select name="_sort" id="sort_by">
|
|
<option value="">Sort...</option>
|
|
{% for column in display_columns %}
|
|
{% if column.sortable %}
|
|
<option value="{{ column.name }}"{% if column.name == sort or column.name == sort_desc %} selected{% endif %}>Sort by {{ column.name }}</option>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<label class="sort_by_desc small-screen-only"><input type="checkbox" name="_sort_by_desc"{% if sort_desc %} checked{% endif %}> descending</label>
|
|
{% endif %}
|
|
{% for facet in sorted_facet_results %}
|
|
<input type="hidden" name="_facet" value="{{ facet.name }}">
|
|
{% endfor %}
|
|
<input type="submit" value="Apply">
|
|
</div>
|
|
</form>
|
|
|
|
{% if query.sql and config.allow_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 class="export-links">This data as <a href="{{ url_json }}">JSON</a>{% if display_rows %}, <a href="{{ url_csv }}">CSV</a> (<a href="#export">advanced</a>){% endif %}</p>
|
|
|
|
{% if suggested_facets %}
|
|
<p class="suggested-facets">
|
|
Suggested facets: {% for facet in suggested_facets %}<a href="{{ facet.toggle_url }}#facet-{{ facet.name|to_css_class }}">{{ facet.name }}</a>{% if not loop.last %}, {% endif %}{% endfor %}
|
|
</p>
|
|
{% endif %}
|
|
|
|
{% if facets_timed_out %}
|
|
<p class="facets-timed-out">These facets timed out: {{ ", ".join(facets_timed_out) }}</p>
|
|
{% endif %}
|
|
|
|
{% if facet_results %}
|
|
<div class="facet-results">
|
|
{% for facet_info in sorted_facet_results %}
|
|
<div class="facet-info facet-{{ database|to_css_class }}-{{ table|to_css_class }}-{{ facet_info.name|to_css_class }}" id="facet-{{ facet_info.name|to_css_class }}">
|
|
<p class="facet-info-name">
|
|
<strong>{{ facet_info.name }}</strong>
|
|
{% if facet_hideable(facet_info.name) %}
|
|
<a href="{{ path_with_removed_args(request, {'_facet': facet_info['name']}) }}" class="cross">✖</a>
|
|
{% endif %}
|
|
</p>
|
|
<ul>
|
|
{% for facet_value in facet_info.results %}
|
|
{% if not facet_value.selected %}
|
|
<li><a href="{{ facet_value.toggle_url }}">{{ (facet_value.label if facet_value.label is not none else "_") }}</a> {{ "{:,}".format(facet_value.count) }}</li>
|
|
{% else %}
|
|
<li>{{ facet_value.label }} · {{ "{:,}".format(facet_value.count) }} <a href="{{ facet_value.toggle_url }}" class="cross">✖</a></li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if facet_info.truncated %}
|
|
<li>...</li>
|
|
{% endif %}
|
|
</ul>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% include custom_rows_and_columns_templates %}
|
|
|
|
{% if next_url %}
|
|
<p><a href="{{ next_url }}">Next page</a></p>
|
|
{% endif %}
|
|
|
|
{% if display_rows %}
|
|
<div id="export" class="advanced-export">
|
|
<h3>Advanced export</h3>
|
|
<p>JSON shape: <a href="{{ url_json }}">default</a>, <a href="{{ append_querystring(url_json, '_shape=array') }}">array</a>{% if primary_keys %}, <a href="{{ append_querystring(url_json, '_shape=object') }}">object</a>{% endif %}</p>
|
|
<form action="{{ url_csv_path }}" method="get">
|
|
<p>
|
|
CSV options:
|
|
<label><input type="checkbox" name="_dl"> download file</label>
|
|
{% if expandable_columns %}<label><input type="checkbox" name="_labels" checked> expand labels</label>{% endif %}
|
|
{% if next_url and config.allow_csv_stream %}<label><input type="checkbox" name="_stream"> stream all rows</label>{% endif %}
|
|
<input type="submit" value="Export CSV">
|
|
{% for key, value in url_csv_hidden_args %}
|
|
<input type="hidden" name="{{ key }}" value="{{ value }}">
|
|
{% endfor %}
|
|
</p>
|
|
</form>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if table_definition %}
|
|
<pre>{{ table_definition }}</pre>
|
|
{% endif %}
|
|
|
|
{% if view_definition %}
|
|
<pre>{{ view_definition }}</pre>
|
|
{% endif %}
|
|
|
|
{% endblock %}
|