Procházet zdrojové kódy

changes to book covers display

joel
Simon Bowie před 1 rokem
rodič
revize
d37f9731b6
5 změnil soubory, kde provedl 16 přidání a 13 odebrání
  1. +4
    -3
      web/app/book.py
  2. +3
    -2
      web/app/practice.py
  3. +3
    -3
      web/app/templates/base.html
  4. +3
    -3
      web/app/templates/book.html
  5. +3
    -2
      web/app/tool.py

+ 4
- 3
web/app/book.py Zobrazit soubor

@@ -31,13 +31,14 @@ def get_books():
else:
kwargs = {'type': type, key: request.args.get(key)}
books = Resource.query.filter_by(**kwargs).all()
# reorder books by book name
books = sorted(books, key=lambda d: d.__dict__['name'])
# get number of books
count = len(books)
if view != 'list':
# append relationships to each book
append_relationships_multiple(books)
append_relationships_multiple(books)
else:
# reorder books by book name
books = sorted(books, key=lambda d: d.__dict__['name'])
# get filters
# practices
practices_filter = Resource.query.filter_by(type='practice').with_entities(Resource.id, Resource.name)

+ 3
- 2
web/app/practice.py Zobrazit soubor

@@ -22,13 +22,14 @@ practice = Blueprint('practice', __name__)
def get_practices():
view = request.args.get('view')
practices = Resource.query.filter_by(type='practice').all()
# reorder practices by practice name
practices = sorted(practices, key=lambda d: d.__dict__['name'])
# get number of practices
count = len(practices)
if view != 'list':
# append relationships to each practice
append_relationships_multiple(practices)
else:
# reorder practices by practice name
practices = sorted(practices, key=lambda d: d.__dict__['name'])
return render_template('resources.html', resources=practices, type='practice', count=count, view=view)

# route for displaying a single practice based on the ID in the database

+ 3
- 3
web/app/templates/base.html Zobrazit soubor

@@ -143,8 +143,8 @@
>

{% if (resource['type'] == 'book') %}
<img class="w-20 h-20 object-contain float-right m-4 grayscale rotate-[15deg]" src="https://dummyimage.com/4:5x70" alt="cover for {{ resource['name'] }}">
{% if (resource.type == 'book') and (resource.references) %}
<img class="w-20 h-20 object-contain float-right m-4 grayscale rotate-[15deg]" src="{{resource.references}}" alt="cover for {{ resource.name }}">
{% endif %}
<h2 class="{{ resource['type'] }} {% if size==1 %} big-title {% else %} small-title {% endif %} mb-2">{{ resource['name'] }}</h2>
@@ -181,7 +181,7 @@


<!DOCTYPE html>
<html>
<html lang="en-gb">

<head>
{{ moment.include_moment() }}

+ 3
- 3
web/app/templates/book.html Zobrazit soubor

@@ -7,13 +7,13 @@
<div class="left">
<div class="mb-2">Book</div>
<div class="border-r-2 border-black pr-8">
{% if resource['thumbnail'] %}
{% if resource.references %}
<div class="float-right">
<img class="w-40 h-40 object-contain m-16 rotate-[15deg]" src={{ resource['thumbnail'] }} alt="cover for {{ resource['Title'] }}">
<img class="w-40 h-40 object-contain m-16 rotate-[15deg]" src={{ resource.references }} alt="cover for {{ resource['Title'] }}">
</div>
{% endif %}
<h2 class="book huge-title mb-2 max-w-[30rem]">{% block title %} {{ resource['Title'] or resource['name'] }} {% endblock %}</h2>
<h2 class="book huge-title mb-2 max-w-[30rem]">{% block title %} {{ resource.name }} {% endblock %}</h2>
{% if resource['Year'] %}
{{ resource['Year'] }}

+ 3
- 2
web/app/tool.py Zobrazit soubor

@@ -34,13 +34,14 @@ def get_tools():
else:
kwargs = {'type': type, key: request.args.get(key)}
tools = Resource.query.filter_by(**kwargs).all()
# reorder tools by tool name
tools = sorted(tools, key=lambda d: d.__dict__['name'])
# get number of tools
count = len(tools)
if view != 'list':
# append relationships to each tool
append_relationships_multiple(tools)
else:
# reorder tools by tools name
tools = sorted(tools, key=lambda d: d.__dict__['name'])
# get filters
# practices
practices_filter = Resource.query.filter_by(type='practice').with_entities(Resource.id, Resource.name)

Načítá se…
Zrušit
Uložit