2018-05-20 00:10:01 +02:00
|
|
|
{% extends 'base.html' %}
|
|
|
|
|
|
|
|
{% block main %}
|
|
|
|
<div class="container">
|
|
|
|
|
|
|
|
<h1 class="header">{{ book.title }}</h1>
|
2018-06-01 17:20:12 +02:00
|
|
|
<img class="no_cover" id="{{ book.title }}" src="../uploads/cover/{{ book.cover }}" width="150" onerror="if (this.src != '../static/img/{{ book.cover }}') this.src = '../static/img/default_cover.png';">
|
2018-05-23 17:50:01 +02:00
|
|
|
<p>Author(s): <ul>{% for author in book.authors %}
|
2018-05-23 14:12:24 +02:00
|
|
|
|
2018-05-23 17:50:01 +02:00
|
|
|
<li><a href="{{url_for('show_author_by_id', id=author.id)}}">{{ author.author_name }}</a> </li>
|
2018-05-23 14:12:24 +02:00
|
|
|
|
2018-05-23 17:50:01 +02:00
|
|
|
{% endfor %}</ul></p>
|
2018-05-23 14:12:24 +02:00
|
|
|
|
2018-06-01 17:20:12 +02:00
|
|
|
<p>Category: {{ book.category }}</p>
|
|
|
|
<p>Year published: {{ book.year_published }}</p>
|
2018-05-31 20:06:13 +02:00
|
|
|
|
2018-05-31 18:04:05 +02:00
|
|
|
<p>Stack(s): <ul>{% for stack in book.stacks %}
|
|
|
|
<li><a href="{{url_for('show_stack_by_id', id=stack.id)}}">{{ stack.stack_name }}</a>
|
|
|
|
|
|
|
|
{% endfor %}</ul></p>
|
|
|
|
|
2018-05-23 14:12:24 +02:00
|
|
|
<a href="../uploads/{{ book.file }}">download {{ book.fileformat }}</a>
|
|
|
|
<br>
|
2018-06-10 12:15:07 +02:00
|
|
|
<br>
|
|
|
|
<p>Instances:</p>
|
|
|
|
{% set got = {} %}
|
|
|
|
{% set all = 1 %}
|
|
|
|
{% for instance in book.instances %}
|
|
|
|
|
|
|
|
{% if instance.name in got %}
|
|
|
|
{% set x=got.__setitem__(instance.name, got[instance.name]+1) %}
|
|
|
|
{% else %}
|
|
|
|
{% set x=got.__setitem__(instance.name, 1) %}
|
|
|
|
{% endif %}
|
|
|
|
{% set all = loop.index %}
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{% for instance, value in got.items() %}
|
|
|
|
{% set result = value/(book.instances|length) %}
|
|
|
|
{{ instance }}: {{ (result*100)|round|int }}%<br>
|
|
|
|
{% endfor %}
|
|
|
|
<br>
|
2018-05-23 14:12:24 +02:00
|
|
|
<br>
|
|
|
|
<a href="{{ url_for('edit_book_by_id', id=book.id )}}">edit</a>
|
2018-05-20 00:10:01 +02:00
|
|
|
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|