Split up code
Add depicts guessing
Redirect for random image
This commit is contained in:
Edward Betts 2019-09-16 08:59:53 +01:00
parent 0719f441c7
commit a909b50329
10 changed files with 706 additions and 177 deletions

View file

@ -24,7 +24,7 @@
{% 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 }})
<a href="{{ set_url_args(**{key: v.qid}) }}">{{ v.label }}</a> ({{ v.count }})
{% if not loop.last %}|{% endif %}
{% endfor %}
</p>

View file

@ -4,6 +4,7 @@
{% block content %}
<div class="m-3">
<p><a href="{{ url_for('random_painting') }}">random painting</a></p>
<ul>
{% for pid, label in props.items() %}
<li><a href="{{ url_for('property_query_page', property_id=pid[1:]) }}">{{ label }}</a>

34
templates/item.html Normal file
View file

@ -0,0 +1,34 @@
{% extends "base.html" %}
{% block title %}{{ label }} ({{qid }}){% endblock %}
{% block content %}
<div class="m-3">
<h1>{{ self.title() }}</h1>
<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>
<p><a href="{{ url_for('random_painting') }}">random painting</a></p>
{% for hit in hits %}
<p>
url: {{ hit.url }}<br>
label: {{ hit.label }}<br>
qid: {{ hit.qid }}<br>
sources: {{ hit.sources() }}<br>
</p>
{% endfor %}
</div>
</div>
<pre>{{ item.query_variables() | pprint }}</pre>
<pre>{{ item.build_query() }}</pre>
</div>
{% endblock %}

View file

@ -10,9 +10,9 @@
<p>Sort order:
{% if order == 'name' %}
<b>name</b> or <a href="?sort=count">count</a>
<b>name</b> or <a href="{{ set_url_args(sort='count') }}">count</a>
{% else %}
<a href="?sort=name">name</a> or <b>count</b>
<a href="{{ set_url_args(sort='name') }}">name</a> or <b>count</b>
{% endif %}
</p>
@ -21,7 +21,7 @@
{% 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>
<a href="{{ url_for('browse_page', **{pid: qid}) }}">{{ row_label }}</a>
{% if 'objectDescription' in row %}
&mdash; {{ row.objectDescription.value }}
{% endif %}