xppl/app/templates/show_book_detail.html
2018-06-13 20:29:25 +02:00

143 lines
4.7 KiB
HTML
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends 'base.html' %}
{% block main %}
<div class="container">
<h1 class="header">{{ book.title }}</h1>
<div style="float:right; padding-right: 140px;">
<img class="no_cover" id="{{ book.title }}" src="../cover/{{ book.cover }}" width="280px" onerror="if (this.src != '../cover/{{ book.cover }}') this.src = '../static/img/default_cover.png';"></div>
<table class="library_table" id="table" style="width:50%; padding-bottom: 20px;">
<thead>
<tr id="header">
<th style="width: 150px;"></th>
<th style="width: 300px;"></th>
</tr>
</thead>
<tbody>
<tr>
<td>Year published: </td>
<td>{{ book.year_published or ''}}</td>
</tr>
<tr>
<td> Author(s): </td>
<td>{% for author in book.authors %}
<a href="{{url_for('show_author_by_id', id=author.id)}}">{{ author.author_name }}</a><br>
{% endfor %}</td>
</tr>
<tr>
<td>Category: </td>
<td>{{ book.category }}</td>
</tr>
<tr>
<td>Included in stack(s): </td>
<td>{% for stack in book.stacks %}
<li><a href="{{url_for('show_stack_by_id', id=stack.id)}}">{{ stack.stack_name }}</a>
<p style="font-size: 10px;"><a href="{{url_for('remove_from_stack', stackid=stack.id, bookid=book.id)}}"> Remove from stack</a>{% endfor %}</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td style="font-style: italic;">Notes from uploader</td>
<td></td>
</tr>
<tr>
<td>How different is this item to the rest of the collection?<br></td>
<td>{{ book.sameness or '?'}} % different</td>
</tr>
<tr>
<td>How diverse are the references in this book?<br></td>
<td>{{ book.diversity or '?' }} % diverse </td>
</tr>
<tr>
<td>Who is speaking?<br></td>
<td>{{ book.gender or '?' }} % female </td>
</tr>
<tr>
<td>Who is uploading<br></td>
<td>{{ book.who or '?' }} </td>
</tr>
<tr>
<td>Instances:</td>
<td>{% 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 %}</td>
</tbody>
</table>
{%if light%}
{%else%}
<br>
<a href="{{url_for('add_to_stack', id=book.id)}}">Add book to Stack ===></a> <br><br>
<br>
{% if book.file %}
<button id="myBtn" style= "width: 180px; font-size: 10pt;"><a> Download this {{ book.fileformat }}</a></button>
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">&times;</span>
<h3>A message from the uploading librarian:</h3>
<span style="font-style: italic;">"{{book.message or '...'}}" </span><br>
<h4><a href="/viewpdf/{{ book.file }}"> >>>> Link to file <<<<</h4></a>
</div>
</div>
{% else %}
{% endif %}
<a href="{{ url_for('edit_book_by_id', id=book.id )}}"><button style= "font-size: 10pt;"> edit</button></a>
<a href="{{ url_for('remove_book_by_id', id=book.id)}}"><button style= "font-size: 10pt;"> delete</button></a>
<br><br>
<br><br>
{%endif%}
{%if res %}
<div style="padding-bottom:20px;">
<h2>Annotations for <i>{{book.title}}</i>:</h4>
{% for row in res%}
<hr>
<p style="font-family:archivo narrow;font-size:10px;">Extract</p>
<div style="font-family:archivo narrow;font-family:archivo narrow;font-size:16px;">
<i>"{{ row.extract }}"</i></div><br>
<p style="font-family:archivo narrow;font-size:10px;color:#ff3300;">Annotation</p>
{%if 'https://www.youtube.com'in row.text %}
<a style="font-family:archivo narrow;font-size:16px;color:#ff3300;" href="{{row.text}}">{{row.text}}</a><br>
{%elif '.jpg' in row.text%}
<img src="{{row.text}}" alt="" width="400">
{%else%}
<div style="font-family:archivo narrow;font-size:16px;color:#ff3300;">{{row.text}}</div><br>
{% endif %}
{% endfor %}
{%else%}<div style="padding-bottom:50px;"><i> No annotations yet for this book </i></div>
{%endif%}
</div>
<hr>
{% if previousbook %}
<a href="{{ url_for('show_book_by_id', id=previousbook.id )}}" style="font-size: 10pt;"> < see the previous book added to XPPL: &nbsp;<i>{{ previousbook.title |truncate(40,True,'...') }} </i></a> {% endif %}
{% if nextbook %}
<a href="{{ url_for('show_book_by_id', id=nextbook.id )}}" style="float:right; font-size: 10pt;"> see the next book added to XPPL: &nbsp;<i>{{ nextbook.title|truncate(40,True,'...')}} </i>> </a>{% endif %}
</div>
{% endblock %}