diff --git a/app.py b/app.py index 9c4022d..5071583 100755 --- a/app.py +++ b/app.py @@ -180,6 +180,9 @@ def property_query_page(property_id): @app.route('/') def start(): return random_painting() + username = wikidata_oauth.get_username() + username = None + return render_template('start.html', username=username) @app.route('/next') def random_painting(): @@ -613,10 +616,15 @@ def catalog_page(): item['url'] = url_for('item_page', item_id=item['item_id']) item['image'] = detail[item['image_filename']] + item_labels = get_labels(qid for pid, qid in params) + title = ' / '.join(find_more_props[pid] + ': ' + item_labels[qid] + for pid, qid in params) + return render_template('catalog.html', labels=find_more_props, items=items, - other=other) + other=other, + title=title) def get_image_detail_with_cache(items, cache_name, thumbwidth=None): filenames = [cur['image_filename'] for cur in items] diff --git a/templates/catalog.html b/templates/catalog.html index 1b35e03..5b55e59 100644 --- a/templates/catalog.html +++ b/templates/catalog.html @@ -1,42 +1,45 @@ {% extends "base.html" %} -{% block style %} - -{% endblock %} +{% block title %}{{ title }}{% endblock %} {% block content %}
- - {% for item in items %} - - - - - {% endfor %} -
- - -

{{ item.label }}

+

{{ self.title() }}

+ {% for item in items %} +
+
+
+ +
+
+
+
{{ item.label }}
- {% for key, prop_label in labels.items() %} - {% set claims = item.entity['claims'][key] %} - {% if claims %} -
- {{ prop_label }}: - {% for claim in claims %} - {% if 'datavalue' in claim.mainsnak %} - {% set claim_qid = claim.mainsnak.datavalue.value.id %} - {{ other[claim_qid] or '[ label missing ]' }} ({{ claim_qid }}) - {% else %} - no value - {% endif %} - {% endfor %} -
- {% endif %} - {% endfor %} -
+

+ view on Wikidata +

+ + {% for key, prop_label in labels.items() %} + {% set claims = item.entity['claims'][key] %} + {% if claims %} +
+ {{ prop_label }}: + {% for claim in claims %} + {% if 'datavalue' in claim.mainsnak %} + {% set claim_qid = claim.mainsnak.datavalue.value.id %} + {{ other[claim_qid] or '[ label missing ]' }} ({{ claim_qid }}) + {% else %} + no value + {% endif %} + {% endfor %} +
+ {% endif %} + {% endfor %} +
+ + + + {% endfor %} {% endblock %}