mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Implemented template inheritance and brought back errors
This commit is contained in:
parent
0fa1772697
commit
b20d7119e4
5 changed files with 40 additions and 15 deletions
14
templates/base.html
Normal file
14
templates/base.html
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{% block title %}{% endblock %}</title>
|
||||
{% block extra_head %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% if error %}
|
||||
<div style="padding: 1em; margin: 1em; border: 3px solid red;">{{ error }}</div>
|
||||
{% endif %}
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ database }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ database }}</h1>
|
||||
|
||||
<style>
|
||||
|
|
@ -25,3 +30,4 @@ td {
|
|||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Databases{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<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 %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -1,3 +1,8 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ database }}: {{ table }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1><a href="/{{ database }}-{{ database_hash }}">{{ database }}</a></h1>
|
||||
|
||||
<h2>{{ table }}</h2>
|
||||
|
|
@ -22,3 +27,4 @@ td {
|
|||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue