2015-08-02 20:59:11 +02:00
{% extends "layout.html" %}
{% block body %}
< div class = "single" >
< div class = "row" >
2017-03-14 19:48:17 +01:00
< div class = "col-sm-3 col-lg-3 col-xs-5" >
2015-08-02 20:59:11 +02:00
< div class = "cover" >
2017-01-21 17:04:36 +01:00
{% if entry.has_cover %}
2016-12-28 11:43:36 +01:00
< img src = "{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" / >
2017-01-21 17:04:36 +01:00
{% else %}
< img src = "{{ url_for('static', filename='generic_cover.jpg') }}" / >
2015-08-02 20:59:11 +02:00
{% endif %}
< / div >
< / div >
2016-04-03 23:33:29 +02:00
< div class = "col-sm-9 col-lg-9 book-meta" >
2015-08-02 20:59:11 +02:00
< h2 > {{entry.title}}< / h2 >
2016-04-15 23:35:18 +02:00
< p class = "author" >
{% for author in entry.authors %}
2017-02-03 13:44:13 +01:00
< a href = "{{url_for('author', id=author.id ) }}" > {{author.name}}< / a >
2016-04-15 23:35:18 +02:00
{% if not loop.last %}
&
{% endif %}
{% endfor %}
< / p >
2015-08-02 20:59:11 +02:00
{% if entry.ratings.__len__() > 0 %}
< div class = "rating" >
2015-10-13 01:21:46 +02:00
< p >
2015-08-02 20:59:11 +02:00
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
< span class = "glyphicon glyphicon-star good" > < / span >
{% if loop.last and loop.index < 5 % }
{% for numer in range(5 - loop.index) %}
< span class = "glyphicon glyphicon-star" > < / span >
{% endfor %}
{% endif %}
{% endfor %}
2015-10-13 01:21:46 +02:00
< / p >
2015-08-02 20:59:11 +02:00
< / div >
{% endif %}
{% if entry.series|length > 0 %}
2017-02-03 13:44:13 +01:00
< p > {{_('Book')}} {{entry.series_index}} {{_('of')}} < a href = "{{url_for('series', id=entry.series[0].id)}}" > {{entry.series[0].name}}< / a > < / p >
2015-08-02 20:59:11 +02:00
{% endif %}
2015-10-13 01:21:46 +02:00
{% if entry.languages.__len__() > 0 %}
< div class = "languages" >
< p >
2016-11-09 19:24:33 +01:00
< span class = "label label-default" > {{_('language')}}: {% for language in entry.languages %} {{language.language_name}}{% if not loop.last %},{% endif %}{% endfor %} < / span >
2015-10-13 01:21:46 +02:00
< / p >
< / div >
{% endif %}
2016-12-27 10:36:06 +01:00
{% if entry.identifiers|length > 0 %}
< div class = "identifiers" >
2017-02-22 20:59:48 +01:00
< p >
2016-12-27 10:36:06 +01:00
< span class = "glyphicon glyphicon-link" > < / span >
{% for identifier in entry.identifiers %}
< a href = "{{identifier}}" target = "_blank" class = "btn btn-xs btn-success" role = "button" > {{identifier.formatType()}}< / a >
{%endfor%}
< / div >
< / p >
{% endif %}
2015-08-02 20:59:11 +02:00
{% if entry.tags|length > 0 %}
2015-10-13 01:21:46 +02:00
< p >
< div class = "tags" >
< span class = "glyphicon glyphicon-tags" > < / span >
2015-08-02 20:59:11 +02:00
{% for tag in entry.tags %}
2017-02-03 13:44:13 +01:00
< a href = "{{ url_for('category', id=tag.id) }}" class = "btn btn-xs btn-info" role = "button" > {{tag.name}}< / a >
2015-08-02 20:59:11 +02:00
{%endfor%}
2015-10-13 01:21:46 +02:00
< / div >
< / p >
2015-08-02 20:59:11 +02:00
{% endif %}
2017-02-22 20:59:48 +01:00
{% if entry.publishers|length > 0 %}
< div class = "publishers" >
< p >
< span > {{_('Publisher')}}:{% for publisher in entry.publishers %} {{publisher.name}}{% if not loop.last %},{% endif %}{% endfor %}< / span >
< / p >
< / div >
{% endif %}
2017-02-15 18:09:17 +01:00
{% if entry.pubdate[:10] != '0101-01-01' %}
< p > {{_('Publishing date')}}: {{entry.pubdate|formatdate}} < / p >
2017-02-03 13:44:13 +01:00
{% endif %}
2016-04-20 00:20:02 +02:00
{% if cc|length > 0 %}
< p >
< div class = "custom_columns" >
{% for c in cc %}
{% if entry['custom_column_' ~ c.id]|length > 0 %}
{{ c.name }}:
{% for column in entry['custom_column_' ~ c.id] %}
2016-04-21 12:59:49 +02:00
{% if c.datatype == 'rating' %}
{{ '%d' % (column.value / 2) }}
{% else %}
2016-11-09 19:24:33 +01:00
{% if c.datatype == 'bool' %}
{% if column.value == true %}
< span class = "glyphicon glyphicon-ok" > < / span >
{% else %}
< span class = "glyphicon glyphicon-remove" > < / span >
{% endif %}
{% else %}
{{ column.value }}
{% endif %}
2016-04-21 12:59:49 +02:00
{% endif %}
2016-04-20 00:20:02 +02:00
{% endfor %}
< br / >
{% endif %}
{% endfor %}
< / div >
< / p >
{% endif %}
2017-03-03 00:56:07 +01:00
{% if not g.user.is_anonymous() %}
2017-02-19 21:08:22 +01:00
< p >
2017-03-12 22:13:14 +01:00
< div class = "custom_columns" id = "have_read_container" >
2017-02-19 21:08:22 +01:00
< form id = "have_read_form" action = "{{ url_for('toggle_read', id=entry.id)}}" method = "POST" ) >
2017-03-12 22:13:14 +01:00
< input id = "have_read_cb" type = "checkbox" { % if have_read % } checked { % endif % } >
< label for = "have_read_cb" > {{_('Read')}}< / label >
2017-02-19 21:08:22 +01:00
< / form >
< / div >
< / p >
2017-03-03 00:56:07 +01:00
{% endif %}
2016-04-20 00:20:02 +02:00
2015-08-02 20:59:11 +02:00
2017-02-03 13:44:13 +01:00
{% if entry.comments|length > 0 and entry.comments[0].text|length > 0%}
2016-11-09 19:24:33 +01:00
< h3 > {{_('Description:')}}< / h3 >
2015-10-11 21:30:43 +02:00
{{entry.comments[0].text|safe}}
2015-08-02 20:59:11 +02:00
{% endif %}
2017-01-12 20:43:36 +01:00
2015-10-13 01:21:46 +02:00
< div class = "more-stuff" >
< div class = "btn-toolbar" role = "toolbar" >
< div class = "btn-group" role = "group" aria-label = "Download, send to Kindle, reading" >
2017-01-12 20:43:36 +01:00
{% if g.user.role_download() %}
2015-10-13 01:21:46 +02:00
< div class = "btn-group" role = "group" >
< button id = "btnGroupDrop1" type = "button" class = "btn btn-primary dropdown-toggle" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
2016-11-09 19:24:33 +01:00
< span class = "glyphicon glyphicon-download" > < / span > {{_('Download')}}
2015-10-13 01:21:46 +02:00
< span class = "caret" > < / span >
< / button >
< ul class = "dropdown-menu" aria-labelledby = "btnGroupDrop1" >
{% for format in entry.data %}
2017-03-09 05:32:10 +01:00
< li > < a href = "{{ url_for('get_download_link_ext', book_id=entry.id, format=format.format|lower, anyname=entry.id|string+'.'+format.format) }}" > {{format.format}}< / a > < / li >
2015-10-13 01:21:46 +02:00
{%endfor%}
< / ul >
< / div >
2017-01-12 20:43:36 +01:00
{% endif %}
2017-02-25 11:14:45 +01:00
{% if g.user.kindle_mail and g.user.is_authenticated %}
2016-11-09 19:24:33 +01:00
< a href = "{{url_for('send_to_kindle', book_id=entry.id)}}" id = "sendbtn" class = "btn btn-primary" role = "button" > < span class = "glyphicon glyphicon-send" > < / span > {{_('Send to Kindle')}}< / a >
2015-10-13 01:21:46 +02:00
{% endif %}
2017-02-25 11:14:45 +01:00
{% if (g.user.role_download() and g.user.is_anonymous()) or g.user.is_authenticated %}
2016-07-16 10:44:47 +02:00
< div class = "btn-group" role = "group" >
< button id = "btnGroupDrop2" type = "button" class = "btn btn-primary dropdown-toggle" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
2016-11-09 19:24:33 +01:00
< span class = "glyphicon glyphicon-eye-open" > < / span > {{_('Read in browser')}}
2016-07-16 10:44:47 +02:00
< span class = "caret" > < / span >
< / button >
< ul class = "dropdown-menu" aria-labelledby = "btnGroupDrop2" >
{% for format in entry.data %}
2016-12-28 11:43:36 +01:00
{%if format.format|lower == 'epub' or format.format|lower == 'txt' or format.format|lower == 'pdf' or format.format|lower == 'cbr' or format.format|lower == 'cbt' or format.format|lower == 'cbz' %}
2016-07-16 10:44:47 +02:00
< li > < a target = "_blank" href = "{{ url_for('read_book', book_id=entry.id, format=format.format|lower) }}" > {{format.format}}< / a > < / li >
{% endif %}
{%endfor%}
< / ul >
< / div >
2017-01-12 20:43:36 +01:00
{% endif %}
2015-10-13 01:21:46 +02:00
< / div >
< / div >
< / br >
2017-01-12 20:43:36 +01:00
{% if g.user.is_authenticated %}
2015-10-13 01:21:46 +02:00
{% if g.user.shelf.all() or g.public_shelfes %}
< div class = "btn-toolbar" role = "toolbar" >
< div class = "btn-group" role = "group" aria-label = "Add to shelves" >
< button id = "btnGroupDrop2" type = "button" class = "btn btn-primary btn-sm dropdown-toggle" data-toggle = "dropdown" aria-haspopup = "true" aria-expanded = "false" >
2016-11-09 19:24:33 +01:00
< span class = "glyphicon glyphicon-list" > < / span > {{_('Add to shelf')}}
2015-10-13 01:21:46 +02:00
< span class = "caret" > < / span >
< / button >
< ul class = "dropdown-menu" aria-labelledby = "btnGroupDrop2" >
{% for shelf in g.user.shelf %}
{% if not shelf.id in books_shelfs and shelf.is_public != 1 %}
< li > < a href = "{{ url_for('add_to_shelf', book_id=entry.id, shelf_id=shelf.id) }}" > {{shelf.name}}< / a > < / li >
{% endif %}
{%endfor%}
{% for shelf in g.public_shelfes %}
{% if not shelf.id in books_shelfs %}
< li > < a href = "{{ url_for('add_to_shelf', book_id=entry.id, shelf_id=shelf.id) }}" > {{shelf.name}}< / a > < / li >
{% endif %}
{%endfor%}
< / ul >
< / div >
2015-10-12 03:09:56 +02:00
{% if books_shelfs %}
2015-10-13 01:21:46 +02:00
< div class = "btn-group" role = "group" aria-label = "Remove from shelves" >
2015-10-12 03:09:56 +02:00
{% for shelf in g.user.shelf %}
{% if shelf.id in books_shelfs and shelf.is_public != 1 %}
2015-10-13 01:21:46 +02:00
< a href = "{{ url_for('remove_from_shelf', book_id=entry.id, shelf_id=shelf.id) }}" class = "btn btn-sm btn-default" role = "button" >
< span class = "glyphicon glyphicon-remove" > < / span > {{shelf.name}}
< / a >
2015-10-12 03:09:56 +02:00
{% endif %}
2015-10-13 01:21:46 +02:00
{%endfor%}
2015-10-12 03:09:56 +02:00
{% for shelf in g.public_shelfes %}
{% if shelf.id in books_shelfs %}
2015-10-13 01:21:46 +02:00
< a href = "{{ url_for('remove_from_shelf', book_id=entry.id, shelf_id=shelf.id) }}" class = "btn btn-sm btn-default" role = "button" >
< span class = "glyphicon glyphicon-remove" > < / span > {{shelf.name}}
< / a >
2015-10-12 03:09:56 +02:00
{% endif %}
2015-10-13 01:21:46 +02:00
{%endfor%}
{% endif %}
< / div >
< / div >
{% endif %}
2017-01-12 20:43:36 +01:00
{% endif %}
2016-04-27 10:35:23 +02:00
{% if g.user.role_edit() %}
2015-10-13 01:21:46 +02:00
< div class = "btn-toolbar" role = "toolbar" >
< div class = "btn-group" role = "group" aria-label = "Edit/Delete book" >
2016-11-09 19:24:33 +01:00
< a href = "{{ url_for('edit_book', book_id=entry.id) }}" class = "btn btn-sm btn-warning" role = "button" > < span class = "glyphicon glyphicon-edit" > < / span > {{_('Edit metadata')}}< / a >
2015-10-13 01:21:46 +02:00
< / div >
{% endif %}
2015-08-02 20:59:11 +02:00
2017-01-12 20:43:36 +01:00
2015-08-02 20:59:11 +02:00
< / div >
< / div >
< / div >
{% endblock %}
2017-02-19 21:08:22 +01:00
{% block js %}
2017-03-12 22:20:09 +01:00
< script src = "{{ url_for('static', filename='js/libs/jquery.form.js') }}" > < / script >
2017-02-19 21:08:22 +01:00
< script >
$( document ).ready(function() {
var haveReadForm = $('#have_read_form');
haveReadForm.ajaxForm();
});
2017-03-12 22:13:14 +01:00
$("#have_read_container").attr('unselectable','on')
2017-02-19 21:08:22 +01:00
.css({'-moz-user-select':'-moz-none',
'-moz-user-select':'none',
'-o-user-select':'none',
'-khtml-user-select':'none', /* you could also put this in a class */
'-webkit-user-select':'none',/* and add the CSS class here instead */
'-ms-user-select':'none',
'user-select':'none'
}).bind('selectstart', function(){ return false; });
2017-03-12 22:13:14 +01:00
$("#have_read_container").click(function() {
2017-02-19 21:08:22 +01:00
var haveReadForm = $('#have_read_form');
if ($("#have_read").find('span').hasClass('glyphicon-ok')) {
$("#have_read").find('span').removeClass('glyphicon-ok');
$("#have_read").find('span').addClass('glyphicon-remove');
} else {
$("#have_read").find('span').removeClass('glyphicon-remove');
$("#have_read").find('span').addClass('glyphicon-ok');
}
haveReadForm.submit()
});
< / script >
{% endblock %}