added splash image to art categories

This commit is contained in:
aj 2019-02-26 00:33:28 +00:00
parent 3b2815c87e
commit a5e9e16b49
3 changed files with 10 additions and 5 deletions

View File

@ -14,8 +14,8 @@ art_print = Blueprint('art', __name__, template_folder='templates')
@art_print.route('/') @art_print.route('/')
def root(): def root():
tags = getTagDicts() tags = getTagDicts()
print(tags) #print(tags)
return render_template('art/index.html', tags = tags, urlprefix = urlprefix) return render_template('art/index.html', tags = tags, staticroot = staticbucketurl, urlprefix = urlprefix)
@art_print.route('/<tag>') @art_print.route('/<tag>')
def tag_view(tag): def tag_view(tag):

View File

@ -16,6 +16,9 @@ def getTagDicts():
dicts = [] dicts = []
for tag in tags: for tag in tags:
dicts.append(tag.to_dict()) dicts.append(tag.to_dict())
for artdict in dicts:
artdict['splash'] = artdict['splash'].get().to_dict()
return dicts return dicts

View File

@ -3,12 +3,14 @@
{% block title %}dev{% endblock %} {% block title %}dev{% endblock %}
{% block content %} {% block content %}
{% for row in tags|batch(2) %} {% for row in tags|batch(4) %}
<div class="row"> <div class="row">
{% for tag in row %} {% for tag in row %}
<div class="col-pad-6 card"> <div class="col-pad-3 card">
<h1>{{ tag.name }}</h1> <h1>{{ tag.name }}</h1>
<p>{{ tag.description }}</p> <img src="{{ staticroot }}art/{{ tag.splash.file_name }}.jpg" alt="{{ tag.splash.file_name }}">
<p>{{ tag.description }}{{ tag.image }}</p>
<a href="/{{ urlprefix }}/{{ tag.doc_name }}" style="width:100%;" class="button">view</a> <a href="/{{ urlprefix }}/{{ tag.doc_name }}" style="width:100%;" class="button">view</a>
</div> </div>
{% endfor %} {% endfor %}