diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..820407a --- /dev/null +++ b/templates/base.html @@ -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> diff --git a/templates/find_more.html b/templates/find_more.html new file mode 100644 index 0000000..163a7af --- /dev/null +++ b/templates/find_more.html @@ -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 %} diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..010671c --- /dev/null +++ b/templates/index.html @@ -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 %} diff --git a/templates/next.html b/templates/next.html new file mode 100644 index 0000000..0c45f85 --- /dev/null +++ b/templates/next.html @@ -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 %} diff --git a/templates/property.html b/templates/property.html new file mode 100644 index 0000000..8fee4ee --- /dev/null +++ b/templates/property.html @@ -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 %} + — {{ 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 %}