Switch to bootstrap cards for catalog page
This commit is contained in:
parent
e2c78d813d
commit
1ef188fa06
10
app.py
10
app.py
|
@ -180,6 +180,9 @@ def property_query_page(property_id):
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def start():
|
def start():
|
||||||
return random_painting()
|
return random_painting()
|
||||||
|
username = wikidata_oauth.get_username()
|
||||||
|
username = None
|
||||||
|
return render_template('start.html', username=username)
|
||||||
|
|
||||||
@app.route('/next')
|
@app.route('/next')
|
||||||
def random_painting():
|
def random_painting():
|
||||||
|
@ -613,10 +616,15 @@ def catalog_page():
|
||||||
item['url'] = url_for('item_page', item_id=item['item_id'])
|
item['url'] = url_for('item_page', item_id=item['item_id'])
|
||||||
item['image'] = detail[item['image_filename']]
|
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',
|
return render_template('catalog.html',
|
||||||
labels=find_more_props,
|
labels=find_more_props,
|
||||||
items=items,
|
items=items,
|
||||||
other=other)
|
other=other,
|
||||||
|
title=title)
|
||||||
|
|
||||||
def get_image_detail_with_cache(items, cache_name, thumbwidth=None):
|
def get_image_detail_with_cache(items, cache_name, thumbwidth=None):
|
||||||
filenames = [cur['image_filename'] for cur in items]
|
filenames = [cur['image_filename'] for cur in items]
|
||||||
|
|
|
@ -1,21 +1,23 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block style %}
|
{% block title %}{{ title }}{% endblock %}
|
||||||
<style>
|
|
||||||
td { vertical-align: top; }
|
|
||||||
</style>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<table>
|
<h1>{{ self.title() }}</h1>
|
||||||
{% for item in items %}
|
{% for item in items %}
|
||||||
<tr>
|
<div class="card mb-3">
|
||||||
<td>
|
<div class="row no-gutters">
|
||||||
<img src="{{ item.image.thumburl }}">
|
<div class="col-md-3">
|
||||||
</td>
|
<img src="{{ item.image.thumburl }}" class="card-img">
|
||||||
<td>
|
</div>
|
||||||
<p>{{ item.label }}</p>
|
<div class="col-md-9">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">{{ item.label }}</h5>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a href="https://www.wikidata.org/wiki/{{ item.qid }}" class="btn btn-primary">view on Wikidata</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
{% for key, prop_label in labels.items() %}
|
{% for key, prop_label in labels.items() %}
|
||||||
{% set claims = item.entity['claims'][key] %}
|
{% set claims = item.entity['claims'][key] %}
|
||||||
|
@ -33,10 +35,11 @@ td { vertical-align: top; }
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</td>
|
</div>
|
||||||
</tr>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue