2015-08-02 20:59:11 +02:00
|
|
|
{% extends "layout.html" %}
|
|
|
|
{% block body %}
|
|
|
|
{% if book %}
|
|
|
|
<div class="col-sm-3 col-lg-3 col-xs-12">
|
|
|
|
<div class="cover">
|
|
|
|
{% if book.has_cover is defined %}
|
|
|
|
<img src="{{ url_for('get_cover', cover_path=book.path) }}" />
|
|
|
|
{% 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">
|
|
|
|
<label for="book_title">Book Title</label>
|
|
|
|
<input type="text" class="form-control" name="book_title" id="book_title" value="{{book.title}}">
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<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">
|
|
|
|
<label for="description">Description</label>
|
|
|
|
<textarea class="form-control" name="description" id="description" rows="7">{% if book.comments %}{{book.comments[0].text}}{%endif%}</textarea>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="tags">Tags</label>
|
|
|
|
<input type="text" class="form-control" name="tags" id="tags" value="{% for tag in book.tags %}{{tag.name.strip()}}, {% endfor %}">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="series">Series</label>
|
|
|
|
<input type="text" class="form-control" 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>
|
|
|
|
<input type="text" class="form-control" name="series_index" id="series_index" value="{{book.series_index}}">
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="rating">Rating</label>
|
2016-04-21 09:04:08 +02:00
|
|
|
<input type="number" min="1" max="5" step="1" class="form-control" name="rating" id="rating" value="{% if book.ratings %}{{book.ratings[0].rating / 2}}{% endif %}">
|
2015-08-02 20:59:11 +02:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="cover_url">Cover URL (jpg)</label>
|
|
|
|
<input type="text" class="form-control" name="cover_url" id="cover_url" value="">
|
|
|
|
</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-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 %}
|
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 %}
|
|
|
|
<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-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 %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
2015-08-02 20:59:11 +02:00
|
|
|
<div class="checkbox">
|
|
|
|
<label>
|
|
|
|
<input name="detail_view" type="checkbox" checked> view book after edit
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-default">Submit</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
2016-04-15 23:35:18 +02:00
|
|
|
|
|
|
|
{% block js %}
|
|
|
|
<script src="{{ url_for('static', filename='js/typeahead.bundle.js') }}"></script>
|
|
|
|
<script src="{{ url_for('static', filename='js/edit_books.js') }}"></script>
|
|
|
|
{% endblock %}
|
|
|
|
{% block header %}
|
|
|
|
<link href="{{ url_for('static', filename='css/typeahead.css') }}" rel="stylesheet" media="screen">
|
|
|
|
{% endblock %}
|