2015-08-02 18:59:11 +00:00
{% extends "layout.html" %}
{% block body %}
{% if book %}
< div class = "col-sm-3 col-lg-3 col-xs-12" >
< div class = "cover" >
2017-01-21 16:04:36 +00:00
{% if book.has_cover %}
2017-02-05 12:40:53 +00:00
< img src = "{{ url_for('get_cover', cover_path=book.path.replace('\\','/')) }}" / >
2017-01-21 16:04:36 +00:00
{% else %}
< img src = "{{ url_for('static', filename='generic_cover.jpg') }}" / >
2015-08-02 18:59:11 +00:00
{% endif %}
< / div >
< / div >
< div class = "col-sm-8" >
< form role = "form" action = "{{ url_for('edit_book', book_id=book.id) }}" method = "post" >
< div class = "form-group" >
2016-11-09 18:24:33 +00:00
< label for = "book_title" > {{_('Book Title')}}< / label >
2015-08-02 18:59:11 +00:00
< input type = "text" class = "form-control" name = "book_title" id = "book_title" value = "{{book.title}}" >
< / div >
< div class = "form-group" >
2016-11-09 18:24:33 +00:00
< label for = "bookAuthor" > {{_('Author')}}< / label >
2016-04-15 21:35:18 +00:00
< input type = "text" class = "form-control typeahead" name = "author_name" id = "bookAuthor" value = "{{' & '.join(authors)}}" autocomplete = "off" >
2015-08-02 18:59:11 +00:00
< / div >
< div class = "form-group" >
2016-11-09 18:24:33 +00:00
< label for = "description" > {{_('Description')}}< / label >
2015-08-02 18:59:11 +00: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 18:24:33 +00:00
< label for = "tags" > {{_('Tags')}}< / label >
< input type = "text" class = "form-control typeahead" name = "tags" id = "tags" value = "{% for tag in book.tags %}{{tag.name.strip()}}, {% endfor %}" >
2015-08-02 18:59:11 +00:00
< / div >
< div class = "form-group" >
2016-11-09 18:24:33 +00:00
< 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 %}" >
2015-08-02 18:59:11 +00:00
< / div >
< div class = "form-group" >
2016-11-09 18:24:33 +00:00
< label for = "series_index" > {{_('Series id')}}< / label >
2015-08-02 18:59:11 +00:00
< input type = "text" class = "form-control" name = "series_index" id = "series_index" value = "{{book.series_index}}" >
< / div >
< div class = "form-group" >
2016-11-09 18:24:33 +00:00
< label for = "rating" > {{_('Rating')}}< / label >
2017-03-07 18:10:17 +00:00
< input type = "number" name = "rating" id = "rating" class = "rating input-lg" data-clearable = "" value = "{% if book.ratings %}{{(book.ratings[0].rating / 2)|int}}{% endif %}" >
2015-08-02 18:59:11 +00:00
< / div >
< div class = "form-group" >
2016-11-09 18:24:33 +00:00
< label for = "cover_url" > {{_('Cover URL (jpg)')}}< / label >
2015-08-02 18:59:11 +00:00
< input type = "text" class = "form-control" name = "cover_url" id = "cover_url" value = "" >
< / div >
2016-11-09 18:24:33 +00:00
< div class = "form-group" >
< label for = "languages" > {{_('Language')}}< / label >
< input type = "text" class = "form-control typeahead" name = "languages" id = "languages" value = "{% for language in book.languages %}{{language.language_name.strip()}}, {% endfor %}" >
< / div >
2016-04-19 22:20:02 +00: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 18:24:33 +00: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 %}
2016-04-21 17:18:52 +00:00
{% if c.datatype in ['text', 'series'] and not c.is_multiple %}
2016-04-20 16:56:03 +00: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 17:18:52 +00: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-19 22:20:02 +00:00
{% endif %}
2016-04-20 16:56:03 +00: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 %}
< option
{% 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 18:24:33 +00:00
2016-04-20 21:53:55 +00: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 16:56:03 +00:00
{% if book['custom_column_' ~ c.id]|length > 0 %}
2016-04-21 10:59:49 +00:00
value="{{ '%d' % (book['custom_column_' ~ c.id][0].value / 2) }}"
2016-04-20 21:53:55 +00:00
{% endif %}>
2016-04-20 16:56:03 +00:00
{% endif %}
< / div >
2016-04-19 22:20:02 +00:00
{% endfor %}
{% endif %}
2015-08-02 18:59:11 +00:00
< div class = "checkbox" >
< label >
2016-11-09 18:24:33 +00:00
< input name = "detail_view" type = "checkbox" checked > {{_('view book after edit')}}
2015-08-02 18:59:11 +00:00
< / label >
< / div >
2017-03-12 18:12:17 +00:00
< a href = "#" id = "get_meta" class = "btn btn-default" data-toggle = "modal" data-target = "#metaModal" > {{_('Get metadata')}}< / a >
2016-11-09 18:24:33 +00:00
< button type = "submit" class = "btn btn-default" > {{_('Submit')}}< / button >
2017-04-02 08:05:07 +00:00
< a href = "{{ url_for('show_book', book_id=book.id) }}" class = "btn btn-default" > {{_('Back')}}< / a >
2015-08-02 18:59:11 +00:00
< / form >
< / div >
{% endif %}
2017-02-21 09:49:43 +00:00
< div class = "modal fade" id = "metaModal" tabindex = "-1" role = "dialog" aria-labelledby = "metaModalLabel" >
< div class = "modal-dialog" role = "document" >
< 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 01:46:09 +00:00
< h4 class = "modal-title" id = "metaModalLabel" > {{_('Get metadata')}}< / h4 >
2017-02-28 06:52:55 +00:00
< form class = "form-inline" >
< div class = "form-group" >
2017-03-07 01:46:09 +00:00
< label class = "sr-only" for = "keyword" > {{_('Keyword')}}< / label >
2017-02-28 06:52:55 +00:00
< input type = "text" class = "form-control" id = "keyword" placeholder = "{{_(" Search keyword " ) } } " >
< / div >
< button type = "button" class = "btn btn-default" id = "do-search" > {{_("Go!")}}< / button >
2017-03-07 01:46:09 +00:00
< span > {{_('Click the cover to load metadata to the form')}}< / span >
2017-02-28 06:52:55 +00:00
< / form >
2017-02-21 09:49:43 +00:00
< / div >
< div class = "modal-body" id = "meta-info" >
{{_("Loading...")}}
< / div >
< div class = "modal-footer" >
< button type = "button" class = "btn btn-default" data-dismiss = "modal" > {{_('Close')}}< / button >
< / div >
< / div >
< / div >
< / div >
2015-08-02 18:59:11 +00:00
{% endblock %}
2016-04-15 21:35:18 +00:00
{% block js %}
2017-03-07 01:46:09 +00:00
< script >
2017-03-30 19:17:18 +00:00
var i18nMsg = {
2017-03-07 01:46:09 +00:00
'loading': {{_('Loading...')|safe|tojson}},
'search_error': {{_('Search error!')|safe|tojson}},
'no_result': {{_('No Result! Please try anonther keyword.')|safe|tojson}},
'author': {{_('Author')|safe|tojson}},
'publisher': {{_('Publisher')|safe|tojson}},
'description': {{_('Description')|safe|tojson}},
'source': {{_('Source')|safe|tojson}},
};
< / script >
2017-02-07 18:11:18 +00:00
< script src = "{{ url_for('static', filename='js/libs/typeahead.bundle.js') }}" > < / script >
2016-04-15 21:35:18 +00:00
< script src = "{{ url_for('static', filename='js/edit_books.js') }}" > < / script >
2017-03-07 18:10:17 +00:00
< script src = "{{ url_for('static', filename='js/libs/bootstrap-rating-input.min.js') }}" > < / script >
2017-02-28 06:52:55 +00:00
< script src = "{{ url_for('static', filename='js/get_meta.js') }}" > < / script >
2016-04-15 21:35:18 +00:00
{% endblock %}
{% block header %}
2017-02-07 18:11:18 +00:00
< link href = "{{ url_for('static', filename='css/libs/typeahead.css') }}" rel = "stylesheet" media = "screen" >
2016-04-15 21:35:18 +00:00
{% endblock %}