mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Implemented multi-db support plus initial URL structure
Refs #24 Fixes #15
This commit is contained in:
parent
6a0c5de615
commit
b2372605d6
5 changed files with 145 additions and 45 deletions
27
templates/database.html
Normal file
27
templates/database.html
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<h1>{{ database }}</h1>
|
||||
|
||||
<style>
|
||||
td {
|
||||
vertical-align: top;
|
||||
border-top: 1px solid #666;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
</style>
|
||||
<table>
|
||||
<tr>
|
||||
{% for header in headers %}<th scope="col">{{ header }}</th>{% endfor %}
|
||||
</tr>
|
||||
{% for row in rows %}
|
||||
<tr>
|
||||
{% for td in row %}
|
||||
<td>
|
||||
{% if loop.index == 2 and row.type == "table" %}
|
||||
<a href="/{{ database }}/{{ td }}">{{ td }}</a>
|
||||
{% else %}
|
||||
{{ td }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
@ -1,21 +1,4 @@
|
|||
<style>
|
||||
td {
|
||||
white-space: pre;
|
||||
vertical-align: top;
|
||||
border-top: 1px solid #666;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
</style>
|
||||
<pre>{{ metadata }}</pre>
|
||||
<table>
|
||||
<tr>
|
||||
{% for header in headers %}<th scope="col">{{ header }}</th>{% endfor %}
|
||||
</tr>
|
||||
{% for row in rows %}
|
||||
<tr>
|
||||
{% for td in row %}
|
||||
<td>{{ td }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<h1>Database{% if databases.keys()|length != 1 %}s{% endif %}</h1>
|
||||
{% for name, info in databases.items() %}
|
||||
<p><a href="{{ name}}-{{ info.hash|truncate(7, end='') }}">{{ name }}</a></p>
|
||||
{% endfor %}
|
||||
|
|
|
|||
24
templates/table.html
Normal file
24
templates/table.html
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<h1><a href="/{{ database }}-{{ database_hash }}">{{ database }}</a></h1>
|
||||
|
||||
<h2>{{ table }}</h2>
|
||||
|
||||
<style>
|
||||
td {
|
||||
white-space: pre;
|
||||
vertical-align: top;
|
||||
border-top: 1px solid #666;
|
||||
padding: 2px 4px;
|
||||
}
|
||||
</style>
|
||||
<table>
|
||||
<tr>
|
||||
{% for header in headers %}<th scope="col">{{ header }}</th>{% endfor %}
|
||||
</tr>
|
||||
{% for row in rows %}
|
||||
<tr>
|
||||
{% for td in row %}
|
||||
<td>{{ td }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
Loading…
Add table
Add a link
Reference in a new issue