2016-05-02 23:25:21 +02:00
|
|
|
{% extends "layout.html" %}
|
|
|
|
{% block body %}
|
|
|
|
<div class="col-sm-8">
|
|
|
|
<form role="form" action="{{ url_for('advanced_search') }}" method="GET">
|
|
|
|
<div class="form-group">
|
2016-11-09 19:24:33 +01:00
|
|
|
<label for="book_title">{{_('Book Title')}}</label>
|
2016-05-02 23:25:21 +02:00
|
|
|
<input type="text" class="form-control" name="book_title" id="book_title" value="">
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
2016-11-09 19:24:33 +01:00
|
|
|
<label for="bookAuthor">{{_('Author')}}</label>
|
2016-05-02 23:25:21 +02:00
|
|
|
<input type="text" class="form-control typeahead" name="author_name" id="bookAuthor" value="" autocomplete="off">
|
|
|
|
</div>
|
2016-11-09 19:24:33 +01:00
|
|
|
<label for="Tags">{{_('Tags')}}</label>
|
2016-05-02 23:25:21 +02:00
|
|
|
<div class="form-group">
|
|
|
|
<div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons">
|
|
|
|
{% for tag in tags %}
|
2016-05-03 14:27:38 +02:00
|
|
|
<label id="tag_{{tag.id}}" class="btn btn-primary tags_click">
|
|
|
|
<input type="checkbox" autocomplete="off" name="include_tag" value="{{tag.id}}">{{tag.name}}</input>
|
|
|
|
</label>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-11-09 19:24:33 +01:00
|
|
|
<label for="Tags">{{_('Exclude Tags')}}</label>
|
2016-05-03 14:27:38 +02:00
|
|
|
<div class="form-group">
|
|
|
|
<div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons">
|
|
|
|
{% for tag in tags %}
|
|
|
|
<label id="tag_{{tag.id}}" class="btn btn-danger tags_click">
|
|
|
|
<input type="checkbox" autocomplete="off" name="exclude_tag" value="{{tag.id}}">{{tag.name}}</input>
|
2016-05-02 23:25:21 +02:00
|
|
|
</label>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-11-09 19:24:33 +01:00
|
|
|
<button type="submit" class="btn btn-default">{{_('Submit')}}</button>
|
2016-05-02 23:25:21 +02:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block js %}
|
|
|
|
<script src="{{ url_for('static', filename='js/typeahead.bundle.js') }}"></script>
|
|
|
|
<script src="{{ url_for('static', filename='js/edit_books.js') }}"></script>
|
|
|
|
<script>
|
2016-11-09 19:24:33 +01:00
|
|
|
$('form')}}.on('change input typeahead:selected', function() {
|
|
|
|
form = $('form')}}.serialize();
|
2016-05-02 23:25:21 +02:00
|
|
|
$.getJSON( "{{ url_for('get_matching_tags') }}", form, function( data ) {
|
2016-05-03 14:27:38 +02:00
|
|
|
$('.tags_click').each(function() {
|
2016-05-02 23:25:21 +02:00
|
|
|
if ($.inArray(parseInt($(this).children('input').first().val(), 10), data.tags) == -1 ) {
|
2016-05-03 14:27:38 +02:00
|
|
|
if (!($(this).hasClass('active'))) {
|
|
|
|
$(this).addClass('disabled');
|
|
|
|
}
|
2016-05-02 23:25:21 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$(this).removeClass('disabled');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
{% endblock %}
|
|
|
|
{% block header %}
|
|
|
|
<link href="{{ url_for('static', filename='css/typeahead.css') }}" rel="stylesheet" media="screen">
|
|
|
|
{% endblock %}
|