Add templates.

This commit is contained in:
Edward Betts 2019-09-13 17:16:37 +01:00
parent 0a6ea8b416
commit 3215333caf
5 changed files with 160 additions and 0 deletions

24
templates/base.html Normal file
View file

@ -0,0 +1,24 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>
{% block title %}{% endblock %}
</title>
{% block style %}{% endblock %}
</head>
<body>
{% block content %}{% endblock %}
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
{% block script %}{% endblock %}
</body>
</html>

58
templates/find_more.html Normal file
View file

@ -0,0 +1,58 @@
{% extends "base.html" %}
{% block title %}{{ label }}{% endblock %}
{% block style %}
<style>
.card-columns { column-count: 6; }
</style>
{% endblock %}
{% block content %}
<div class="m-3">
<h1>{{ self.title() }}</h1>
{#
{% for key, label in property_labels.items() %}
<h4>{{ label }} ({{ key }})</h4>
<pre>{{ item_entity['claims'][key] | pprint }}</pre>
{% endfor %}
#}
<p>{{ '{:,d}'.format(total) }} paintings found</p>
{% for key, values in facets.items() %}
<p>{{ prop_labels[key] }}:
{% for v in values %}
<a href="?{{ request.query_string.decode('utf-8') }}&{{key}}={{v.qid}}">{{ v.label }}</a> ({{ v.count }})
{% if not loop.last %}|{% endif %}
{% endfor %}
</p>
{% endfor %}
<div class="card-columns">
{% for item in items %}
{% set image = item.image %}
<div class="card">
<a href="{{ item.url }}">
{# <img src="{{ image.thumburl }}" height="{{ image.thumbheight }}" width="{{ image.thumbwidth }}" class="card-img-top"></a> #}
<img src="{{ image.thumburl }}" class="card-img-top"></a>
<div class="card-body">
<h5 class="card-title">{{ item.label }}</h5>
<p class="card-text">by {{ item.artist_name }}
{% if item.date %}({{ item.date }}){% endif %}
</p>
</div>
</div>
{% endfor %}
</div>
{#
{% for item in items %}
<pre>{{ item | pprint }}</pre>
{% endfor %}
#}
</div>
{% endblock %}

16
templates/index.html Normal file
View file

@ -0,0 +1,16 @@
{% extends "base.html" %}
{% block title %}Wikidata painting depicts{% endblock %}
{% block content %}
<div class="m-3">
<ul>
{% for pid, label in props.items() %}
<li><a href="{{ url_for('property_query_page', property_id=pid[1:]) }}">{{ label }}</a>
({{ pid }})
</li>
{% endfor %}
</ul>
</div>
{% endblock %}

32
templates/next.html Normal file
View file

@ -0,0 +1,32 @@
{% extends "base.html" %}
{% block title %}{{ label }} ({{qid }}){% endblock %}
{% block content %}
<div class="m-3">
<h1>{{ self.title() }}</h1>
{# <pre>{{ other | pprint }}</pre> #}
{# <img src="{{ image.thumburl }}" height="{{ image.thumbheight }}" width="{{ image.thumbwidth }}"> #}
<div class="row">
<div class="col">
<img src="{{ image.thumburl }}">
</div>
<div class="col">
<p><a href="https://www.wikidata.org/wiki/{{ qid }}">view on Wikidata</a></p>
{% for key, prop_label in labels.items() %}
{% set claims = entity['claims'][key] %}
{% if claims %}
<h3>{{ prop_label }} ({{ key }})</h3>
{% for claim in claims %}
{% set claim_qid = claim.mainsnak.datavalue.value.id %}
<a href="{{ url_for('find_more_page', property_id=key[1:], item_id=claim_qid[1:]) }}">{{ other[claim_qid] }}</a> ({{ claim_qid }})
{% endfor %}
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% endblock %}

30
templates/property.html Normal file
View file

@ -0,0 +1,30 @@
{% extends "base.html" %}
{% block title %}{{ label }}{% endblock %}
{% block content %}
<div class="m-3">
<h1>{{ self.title() }}</h1>
<p><a href="{{ url_for('index') }}">back to index</a></p>
<ul>
{% for row in rows if '/' in row.object.value %}
{% set qid = row.object.value.rpartition('/')[2] %}
{% set row_label = row.objectLabel.value if 'objectLabel' in row else '[ label missing ]' %}
<li>
<a href="{{ url_for('browse_page') }}?{{ pid }}={{ qid }}">{{ row_label }}</a>
{% if 'objectDescription' in row %}
&mdash; {{ row.objectDescription.value }}
{% endif %}
({{ '{:,d}'.format(row.count.value | int) }} paintings)
{% if 'objectLabel' not in row %}
<a href="https://wikidata.org/wiki/{{ qid }}">view in Wikidata</a>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
{% endblock %}