2015-08-02 20:59:11 +02:00
{% extends "layout.html" %}
{% block body %}
{% if book %}
2018-08-29 01:13:04 +02:00
2017-04-14 20:29:11 +02:00
< div class = "col-sm-3 col-lg-3 col-xs-12" >
< div class = "cover" >
{% if book.has_cover %}
2019-02-03 20:29:16 +01:00
< img src = "{{ url_for('get_cover', book_id=book.id) }}" alt = "{{ book.title }}" / >
2017-04-14 20:29:11 +02:00
{% else %}
2018-10-03 14:03:08 +02:00
< img src = "{{ url_for('static', filename='generic_cover.jpg') }}" alt = "{{ book.title }}" / >
2017-04-14 20:29:11 +02:00
{% endif %}
< / div >
{% if g.user.role_delete_books() %}
< div class = "text-center" >
< button type = "button" class = "btn btn-danger" id = "delete" data-toggle = "modal" data-target = "#deleteModal" > {{_("Delete Book")}}< / button >
< / div >
2018-08-04 18:22:43 +02:00
{% if book.data|length > 1 %}
2018-08-31 15:00:22 +02:00
< div class = "text-center more-stuff" > < h4 > {{_('Delete formats:')}}< / h4 >
2018-08-04 18:22:43 +02:00
{% for file in book.data %}
< div class = "form-group" >
< a href = "{{ url_for('delete_book', book_id=book.id, book_format=file.format) }}" class = "btn btn-danger" type = "button" > {{_('Delete')}} - {{file.format}}< / a >
< / div >
{% endfor %}
< / div >
{% endif %}
2017-04-14 20:29:11 +02:00
{% endif %}
2018-08-29 01:13:04 +02:00
2018-09-09 18:17:15 +02:00
{% if source_formats|length > 0 and conversion_formats|length > 0 %}
2018-08-31 15:00:22 +02:00
< div class = "text-center more-stuff" > < h4 > {{_('Convert book format:')}}< / h4 >
< form class = "padded-bottom" action = "{{ url_for('convert_bookformat', book_id=book.id) }}" method = "post" id = "book_convert_frm" >
2018-08-29 01:13:04 +02:00
< div class = "form-group" >
< div class = "text-left" >
< label class = "control-label" for = "book_format_from" > {{_('Convert from:')}}< / label >
< select class = "form-control" name = "book_format_from" id = "book_format_from" >
2018-09-03 19:12:15 +02:00
< option disabled selected value > -- {{_('select an option')}} -- < / option >
2018-09-09 18:17:15 +02:00
{% for format in source_formats %}
< option > {{format|upper}} < / option >
2018-08-29 01:13:04 +02:00
{% endfor %}
< / select >
< label class = "control-label" for = "book_format_to" > {{_('Convert to:')}}< / label >
< select class = "form-control" name = "book_format_to" id = "book_format_to" >
2018-09-03 19:12:15 +02:00
< option disabled selected value > -- {{_('select an option')}} -- < / option >
2018-08-29 01:13:04 +02:00
{% for format in conversion_formats %}
< option > {{format|upper}} < / option >
{% endfor %}
< / select >
< / div >
< / div >
2018-08-31 15:00:22 +02:00
< button type = "submit" class = "btn btn-primary" id = "btn-book-convert" name = "btn-book-convert" > < span class = "glyphicon glyphicon-duplicate" > < / span > {{_('Convert book')}}< / button >
2018-08-29 01:13:04 +02:00
< / form >
< / div >
{% endif %}
2015-08-02 20:59:11 +02:00
< / div >
2018-08-29 01:13:04 +02:00
< form role = "form" action = "{{ url_for('edit_book', book_id=book.id) }}" method = "post" enctype = "multipart/form-data" id = "book_edit_frm" >
2017-04-14 20:29:11 +02:00
< div class = "col-sm-9 col-xs-12" >
2015-08-02 20:59:11 +02:00
< div class = "form-group" >
2016-11-09 19:24:33 +01:00
< label for = "book_title" > {{_('Book Title')}}< / label >
2015-08-02 20:59:11 +02:00
< input type = "text" class = "form-control" name = "book_title" id = "book_title" value = "{{book.title}}" >
< / div >
< div class = "form-group" >
2016-11-09 19:24:33 +01:00
< label for = "bookAuthor" > {{_('Author')}}< / label >
2016-04-15 23:35:18 +02:00
< input type = "text" class = "form-control typeahead" name = "author_name" id = "bookAuthor" value = "{{' & '.join(authors)}}" autocomplete = "off" >
2015-08-02 20:59:11 +02:00
< / div >
< div class = "form-group" >
2016-11-09 19:24:33 +01:00
< label for = "description" > {{_('Description')}}< / label >
2015-08-02 20:59:11 +02:00
< textarea class = "form-control" name = "description" id = "description" rows = "7" > {% if book.comments %}{{book.comments[0].text}}{%endif%}< / textarea >
< / div >
< div class = "form-group" >
2016-11-09 19:24:33 +01:00
< label for = "tags" > {{_('Tags')}}< / label >
2018-09-02 14:05:09 +02:00
< input type = "text" class = "form-control typeahead" name = "tags" id = "tags" value = "{% for tag in book.tags %}{{tag.name.strip()}}{% if not loop.last %}, {% endif %}{% endfor %}" >
2015-08-02 20:59:11 +02:00
< / div >
2017-07-10 01:28:06 +02:00
< div class = "form-group" >
< label for = "series" > {{_('Series')}}< / label >
< input type = "text" class = "form-control typeahead" name = "series" id = "series" value = "{% if book.series %}{{book.series[0].name}}{% endif %}" >
< / div >
< div class = "form-group" >
< label for = "series_index" > {{_('Series id')}}< / label >
2018-08-16 21:17:26 +02:00
< input type = "number" step = "0.1" min = "0" class = "form-control" name = "series_index" id = "series_index" value = "{{book.series_index}}" >
2017-07-10 01:28:06 +02:00
< / div >
< div class = "form-group" >
< label for = "rating" > {{_('Rating')}}< / label >
< input type = "number" name = "rating" id = "rating" class = "rating input-lg" data-clearable = "" value = "{% if book.ratings %}{{(book.ratings[0].rating / 2)|int}}{% endif %}" >
< / div >
< div class = "form-group" >
2018-03-27 20:42:19 +02:00
< label for = "cover_url" > {{_('Cover URL (jpg, cover is downloaded and stored in database, field is afterwards empty again)')}}< / label >
2017-07-10 01:28:06 +02:00
< input type = "text" class = "form-control" name = "cover_url" id = "cover_url" value = "" >
< / div >
2018-08-28 14:07:48 +02:00
< div class = "form-group" aria-label = "Upload cover from local drive" >
2018-08-31 15:00:22 +02:00
< label class = "btn btn-primary btn-file" for = "btn-upload-cover" > {{ _('Upload Cover from local drive') }}< / label >
2018-08-28 14:07:48 +02:00
< div class = "upload-cover-input-text" id = "upload-cover" > < / div >
< input id = "btn-upload-cover" name = "btn-upload-cover" type = "file" >
< / div >
2017-07-10 01:27:46 +02:00
< div class = "form-group" >
2017-07-10 18:22:21 +02:00
< label for = "pubdate" > {{_('Publishing date')}}< / label >
2017-07-18 17:51:52 +02:00
< div style = "position: relative" >
< input type = "date" class = "form-control" name = "pubdate" id = "pubdate" value = "{% if book.pubdate %}{{book.pubdate|formatdateinput}}{% endif %}" >
< input type = "text" class = "form-control fake-input hidden" id = "fake_pubdate" value = "{% if book.pubdate %}{{book.pubdate|formatdate}}{% endif %}" >
< / div >
2017-07-10 01:27:46 +02:00
< / div >
2018-09-02 17:21:01 +02:00
< div class = "form-group" >
< label for = "publisher" > {{_('Publisher')}}< / label >
2018-09-30 14:08:55 +02:00
< input type = "text" class = "form-control typeahead" name = "publisher" id = "publisher" value = "{% if book.publishers|length > 0 %}{{book.publishers[0].name}}{% endif %}" >
2018-09-02 17:21:01 +02:00
< / div >
2016-11-09 19:24:33 +01:00
< div class = "form-group" >
< label for = "languages" > {{_('Language')}}< / label >
2018-09-02 14:05:09 +02:00
< input type = "text" class = "form-control typeahead" name = "languages" id = "languages" value = "{% for language in book.languages %}{{language.language_name.strip()}}{% if not loop.last %}, {% endif %}{% endfor %}" >
2016-11-09 19:24:33 +01:00
< / div >
2016-04-20 00:20:02 +02:00
{% if cc|length > 0 %}
{% for c in cc %}
< div class = "form-group" >
< label for = "{{ 'custom_column_' ~ c.id }}" > {{ c.name }}< / label >
2016-11-09 19:24:33 +01:00
{% if c.datatype == 'bool' %}
< select name = "{{ 'custom_column_' ~ c.id }}" id = "{{ 'custom_column_' ~ c.id }}" class = "form-control" >
< option value = "None" { % if book [ ' custom_column_ ' ~ c . id ] | length = = 0 % } selected { % endif % } > < / option >
< option value = "True" { % if book [ ' custom_column_ ' ~ c . id ] | length > 0 %}{% if book['custom_column_' ~ c.id][0].value ==true %}selected{% endif %}{% endif %} >{{_('Yes')}}< / option >
< option value = "False" { % if book [ ' custom_column_ ' ~ c . id ] | length > 0 %}{% if book['custom_column_' ~ c.id][0].value ==false %}selected{% endif %}{% endif %}>{{_('No')}}< / option >
< / select >
{% endif %}
2017-05-22 22:54:53 +02:00
{% if c.datatype == 'int' %}
2017-05-25 08:20:19 +02:00
< input type = "number" step = "1" class = "form-control" name = "{{ 'custom_column_' ~ c.id }}" id = "{{ 'custom_column_' ~ c.id }}" value = "{% if book['custom_column_' ~ c.id]|length > 0 %}{{ book['custom_column_' ~ c.id][0].value }}{% endif %}" >
2017-05-22 22:54:53 +02:00
{% endif %}
2016-04-21 19:18:52 +02:00
{% if c.datatype in ['text', 'series'] and not c.is_multiple %}
2016-04-20 18:56:03 +02:00
< input type = "text" class = "form-control" name = "{{ 'custom_column_' ~ c.id }}" id = "{{ 'custom_column_' ~ c.id }}"
{% if book['custom_column_' ~ c.id]|length > 0 %}
2016-04-21 19:18:52 +02:00
value="{{ book['custom_column_' ~ c.id][0].value }}"
{% endif %}>
{% endif %}
{% if c.datatype in ['text', 'series'] and c.is_multiple %}
< input type = "text" class = "form-control" name = "{{ 'custom_column_' ~ c.id }}" id = "{{ 'custom_column_' ~ c.id }}"
{% if book['custom_column_' ~ c.id]|length > 0 %}
value="{% for column in book['custom_column_' ~ c.id] %}{{ column.value.strip() }}{% if not loop.last %}, {% endif %}{% endfor %}"{% endif %}>
2016-04-20 00:20:02 +02:00
{% endif %}
2017-05-22 22:54:53 +02:00
2016-04-20 18:56:03 +02:00
{% if c.datatype == 'enumeration' %}
< select class = "form-control" name = "{{ 'custom_column_' ~ c.id }}" id = "{{ 'custom_column_' ~ c.id }}" >
< option > < / option >
{% for opt in c.get_display_dict().enum_values %}
2017-05-22 22:54:53 +02:00
< option
2016-04-20 18:56:03 +02:00
{% if book['custom_column_' ~ c.id]|length > 0 %}
{% if book['custom_column_' ~ c.id][0].value == opt %}selected="selected"{% endif %}
{% endif %}
>{{ opt }}< / option >
{% endfor %}
< / select >
{% endif %}
2016-11-09 19:24:33 +01:00
2016-04-20 23:53:55 +02:00
{% if c.datatype == 'rating' %}
< input type = "number" min = "1" max = "5" step = "1" class = "form-control" name = "{{ 'custom_column_' ~ c.id }}" id = "{{ 'custom_column_' ~ c.id }}"
2016-04-20 18:56:03 +02:00
{% if book['custom_column_' ~ c.id]|length > 0 %}
2016-04-21 12:59:49 +02:00
value="{{ '%d' % (book['custom_column_' ~ c.id][0].value / 2) }}"
2016-04-20 23:53:55 +02:00
{% endif %}>
2016-04-20 18:56:03 +02:00
{% endif %}
< / div >
2016-04-20 00:20:02 +02:00
{% endfor %}
2017-05-22 22:54:53 +02:00
{% endif %}
2017-08-09 19:56:46 +02:00
{% if g.user.role_upload() or g.user.role_admin()%}
{% if g.allow_upload %}
< div role = "group" aria-label = "Upload new book format" >
2018-08-31 15:00:22 +02:00
< label class = "btn btn-primary btn-file" for = "btn-upload-format" > {{ _('Upload format') }}< / label >
2017-08-09 19:56:46 +02:00
< div class = "upload-format-input-text" id = "upload-format" > < / div >
< input id = "btn-upload-format" name = "btn-upload-format" type = "file" >
< / div >
{% endif %}
{% endif %}
2017-05-22 22:54:53 +02:00
2015-08-02 20:59:11 +02:00
< div class = "checkbox" >
< label >
2016-11-09 19:24:33 +01:00
< input name = "detail_view" type = "checkbox" checked > {{_('view book after edit')}}
2015-08-02 20:59:11 +02:00
< / label >
< / div >
2017-03-12 19:12:17 +01:00
< a href = "#" id = "get_meta" class = "btn btn-default" data-toggle = "modal" data-target = "#metaModal" > {{_('Get metadata')}}< / a >
2018-10-03 14:03:08 +02:00
< button type = "submit" id = "submit" class = "btn btn-default" > {{_('Submit')}}< / button >
2017-04-02 10:05:07 +02:00
< a href = "{{ url_for('show_book', book_id=book.id) }}" class = "btn btn-default" > {{_('Back')}}< / a >
2017-04-14 20:29:11 +02:00
< / div >
< / form >
{% endif %}
2017-04-21 20:44:17 +02:00
{% endblock %}
{% block modal %}
2017-04-14 20:29:11 +02:00
{% if g.user.role_delete_books() %}
< div class = "modal fade" id = "deleteModal" role = "dialog" aria-labelledby = "metaDeleteLabel" >
< div class = "modal-dialog" >
< div class = "modal-content" >
< div class = "modal-header bg-danger text-center" >
2018-08-24 15:48:09 +02:00
< span > {{_('Are you really sure?')}}< / span >
2017-04-14 20:29:11 +02:00
< / div >
2017-08-13 07:24:56 +02:00
< div class = "modal-body text-center" >
2017-04-14 20:29:11 +02:00
< span > {{_('Book will be deleted from Calibre database')}}< / span >
< span > {{_('and from hard disk')}}< / span >
< / div >
< div class = "modal-footer" >
< a href = "{{ url_for('delete_book', book_id=book.id) }}" class = "btn btn-danger" > {{_('Delete')}}< / a >
< button type = "button" class = "btn btn-default" data-dismiss = "modal" > {{_('Back')}}< / button >
< / div >
< / div >
< / div >
2015-08-02 20:59:11 +02:00
< / div >
{% endif %}
2017-04-14 20:29:11 +02:00
2017-02-21 10:49:43 +01:00
< div class = "modal fade" id = "metaModal" tabindex = "-1" role = "dialog" aria-labelledby = "metaModalLabel" >
2017-08-16 06:31:15 +02:00
< div class = "modal-dialog modal-lg" role = "document" >
2017-02-21 10:49:43 +01:00
< div class = "modal-content" >
< div class = "modal-header" >
< button type = "button" class = "close" data-dismiss = "modal" aria-label = "Close" > < span aria-hidden = "true" > × < / span > < / button >
2017-03-07 02:46:09 +01:00
< h4 class = "modal-title" id = "metaModalLabel" > {{_('Get metadata')}}< / h4 >
2017-08-16 06:31:15 +02:00
< form class = "padded-bottom" id = "meta-search" >
< div class = "input-group" >
2017-03-07 02:46:09 +01:00
< label class = "sr-only" for = "keyword" > {{_('Keyword')}}< / label >
2017-08-16 06:31:15 +02:00
< input type = "text" class = "form-control" id = "keyword" name = "keyword" placeholder = "{{_(" Search keyword " ) } } " >
< span class = "input-group-btn" >
< button type = "submit" class = "btn btn-primary" id = "do-search" > {{_("Go!")}}< / button >
< / span >
2017-02-28 07:52:55 +01:00
< / div >
< / form >
2019-03-01 21:00:09 +01:00
< div class = "text-center" > < strong > {{_('Click the cover to load metadata to the form')}}< / strong > < / div >
2017-02-21 10:49:43 +01:00
< / div >
2017-08-16 06:31:15 +02:00
< div class = "modal-body" >
< div class = "text-center padded-bottom" >
< input type = "checkbox" id = "show-douban" class = "pill" data-control = "douban" checked >
< label for = "show-douban" > Douban < span class = "glyphicon glyphicon-ok" > < / span > < / label >
< input type = "checkbox" id = "show-google" class = "pill" data-control = "google" checked >
< label for = "show-google" > Google < span class = "glyphicon glyphicon-ok" > < / span > < / label >
< / div >
< div id = "meta-info" >
{{_("Loading...")}}
< / div >
< ul id = "book-list" class = "media-list" > < / ul >
2017-02-21 10:49:43 +01:00
< / div >
< div class = "modal-footer" >
< button type = "button" class = "btn btn-default" data-dismiss = "modal" > {{_('Close')}}< / button >
< / div >
< / div >
< / div >
< / div >
2015-08-02 20:59:11 +02:00
{% endblock %}
2016-04-15 23:35:18 +02:00
{% block js %}
2017-08-16 06:31:15 +02:00
< script type = "text/template" id = "template-book-result" >
< li class = "media" data-related = "<%= source.id %>" >
< img class = "pull-left img-responsive"
data-toggle="modal"
data-target="#metaModal"
src="< %= cover %>"
alt="Cover"
>
< div class = "media-body" >
< h4 class = "media-heading" >
< a href = "<%= url %>" target = "_blank" rel = "noopener" > < %= title %>< / a >
< / h4 >
< p > {{_('Author')}}: < %= authors.join(" & ") %>< / p >
< % if (publisher) { %>
< p > {{_('Publisher')}}: < %= publisher %>< / p >
< % } %>
< % if (description) { %>
< p > {{_('Description')}}: < %= description %>< / p >
< % } %>
< p > {{_('Source')}}:
< a href = "<%= source.url %>" target = "_blank" rel = "noopener" > < %= source.description %>< / a >
< / p >
< / div >
< / li >
< / script >
2017-03-07 02:46:09 +01:00
< script >
2017-03-30 21:17:18 +02:00
var i18nMsg = {
2017-03-07 02:46:09 +01:00
'loading': {{_('Loading...')|safe|tojson}},
'search_error': {{_('Search error!')|safe|tojson}},
2018-08-24 15:48:09 +02:00
'no_result': {{_('No Result(s) found! Please try aonther keyword.')|safe|tojson}},
2017-03-07 02:46:09 +01:00
'author': {{_('Author')|safe|tojson}},
'publisher': {{_('Publisher')|safe|tojson}},
'description': {{_('Description')|safe|tojson}},
'source': {{_('Source')|safe|tojson}},
};
2017-07-18 17:51:52 +02:00
var language = '{{ g.user.locale }}';
2017-03-07 02:46:09 +01:00
< / script >
2017-02-07 19:11:18 +01:00
< script src = "{{ url_for('static', filename='js/libs/typeahead.bundle.js') }}" > < / script >
2017-03-07 19:10:17 +01:00
< script src = "{{ url_for('static', filename='js/libs/bootstrap-rating-input.min.js') }}" > < / script >
2017-02-28 07:52:55 +01:00
< script src = "{{ url_for('static', filename='js/get_meta.js') }}" > < / script >
2017-06-22 17:47:20 +02:00
< script src = "{{ url_for('static', filename='js/libs/tinymce/tinymce.min.js') }}" > < / script >
2017-07-10 18:22:21 +02:00
< script src = "{{ url_for('static', filename='js/libs/bootstrap-datepicker/bootstrap-datepicker.min.js') }}" > < / script >
{% if not g.user.locale == 'en' %}
< script src = "{{ url_for('static', filename='js/libs/bootstrap-datepicker/locales/bootstrap-datepicker.' + g.user.locale + '.min.js') }}" charset = "UTF-8" > < / script >
{% endif %}
2017-07-18 17:51:52 +02:00
< script src = "{{ url_for('static', filename='js/edit_books.js') }}" > < / script >
2016-04-15 23:35:18 +02:00
{% endblock %}
{% block header %}
2017-02-07 19:11:18 +01:00
< link href = "{{ url_for('static', filename='css/libs/typeahead.css') }}" rel = "stylesheet" media = "screen" >
2017-07-10 18:22:21 +02:00
< link href = "{{ url_for('static', filename='css/libs/bootstrap-datepicker3.min.css') }}" rel = "stylesheet" media = "screen" >
2016-04-15 23:35:18 +02:00
{% endblock %}