Merge branch 'master' of git.xpub.nl:/var/www/git.xpub.nl/repos/xpub-lib
This commit is contained in:
commit
9c84e75e8c
@ -76,7 +76,8 @@ class SearchForm(FlaskForm):
|
|||||||
('Title', 'Title'),
|
('Title', 'Title'),
|
||||||
('Author', 'Author'),
|
('Author', 'Author'),
|
||||||
('Category', 'Category'),
|
('Category', 'Category'),
|
||||||
('Stack', 'Stack')]
|
('Stack', 'Stack'),
|
||||||
|
('Outliers', 'Outliers')]
|
||||||
select = SelectField('', choices=choices, default='All')
|
select = SelectField('', choices=choices, default='All')
|
||||||
search = StringField('', validators=[InputRequired()])
|
search = StringField('', validators=[InputRequired()])
|
||||||
grid = SubmitField('Grid')
|
grid = SubmitField('Grid')
|
||||||
|
@ -60,19 +60,16 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="padding-left:10px; padding-bottom: 50px;">
|
<div style="padding-left:10px; padding-bottom: 100px;">
|
||||||
|
<br>
|
||||||
Category: {{ form.category(size=27, class="form-control") }}
|
Category: {{ form.category(size=27, class="form-control") }}
|
||||||
<br>
|
<br>
|
||||||
<br>
|
|
||||||
Year published: {{ form.year_published(size=8, class="form-control") }}
|
|
||||||
<br>
|
|
||||||
<br>
|
<br>
|
||||||
{{ form.file }}
|
{{ form.file }}
|
||||||
{{ form.upload }}
|
{{ form.upload }}
|
||||||
{{ form.wish }}
|
{{ form.wish }}
|
||||||
</form>
|
</form>
|
||||||
<br>
|
<br>
|
||||||
<p><a href="{{ url_for('home') }}" style="font-size: 9pt;">go back home</a></p>
|
|
||||||
<br>
|
<br>
|
||||||
</div>
|
</div>
|
||||||
<div class= "Container" style= "border-top: dashed; border-width: 1px;">
|
<div class= "Container" style= "border-top: dashed; border-width: 1px;">
|
||||||
|
@ -63,6 +63,7 @@
|
|||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<a href="{{url_for('add_to_stack', id=book.id)}}">Add book to Stack ===></a> <br><br>
|
||||||
|
|
||||||
<a href="../uploads/{{ book.file }}">download {{ book.fileformat }}</a>
|
<a href="../uploads/{{ book.file }}">download {{ book.fileformat }}</a>
|
||||||
<br>
|
<br>
|
||||||
@ -93,7 +94,7 @@
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<span class="close">×</span>
|
<span class="close">×</span>
|
||||||
<h3>A message from the uploading librarian:</h3>
|
<h3>A message from the uploading librarian:</h3>
|
||||||
<span style="font-style: italic;">"{{book.message or 'Happy reading.'}}" </span><br>
|
<span style="font-style: italic;">"{{book.message or '...'}}" </span><br>
|
||||||
<h4><a href="../uploads/{{ book.file }}"> >>>> Link to file <<<<</h4></a></div>
|
<h4><a href="../uploads/{{ book.file }}"> >>>> Link to file <<<<</h4></a></div>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -525,14 +525,16 @@ def search_results(searchtype, query, viewby):
|
|||||||
if searchtype== 'Stack':
|
if searchtype== 'Stack':
|
||||||
results=db.session.query(Book).join(Book.stacks).filter(Stack.stack_name.contains(query)).order_by(Book.title)
|
results=db.session.query(Book).join(Book.stacks).filter(Stack.stack_name.contains(query)).order_by(Book.title)
|
||||||
|
|
||||||
|
if searchtype== 'Outliers':
|
||||||
|
results=Book.query.filter(Book.sameness > 50).order_by(Book.title)
|
||||||
|
|
||||||
if searchtype== 'All':
|
if searchtype== 'All':
|
||||||
# results=Book.query.whoosh_search(query)
|
# results=Book.query.whoosh_search(query)
|
||||||
results=Book.query.filter(Book.title.contains(query))
|
results=Book.query.filter(Book.title.contains(query))
|
||||||
results=results.union(Book.query.filter(Book.category.contains(query)))
|
results=results.union(Book.query.filter(Book.category.contains(query)))
|
||||||
results=results.union(Book.query.filter(Book.year_published.contains(query)))
|
results=results.union(Book.query.filter(Book.year_published.contains(query)))
|
||||||
results=results.union(db.session.query(Book).join(Book.authors).filter(Author.author_name.contains(query)))
|
results=results.union(db.session.query(Book).join(Book.authors).filter(Author.author_name.contains(query)))
|
||||||
results=results.union(db.session.query(Book).join(Book.stacks).filter(Stack.stack_name.contains(query)))
|
results=results.union(db.session.query(Book).join(Book.stacks).filter(Stack.stack_name.contains(query))).order_by(Book.title)
|
||||||
results=results.union(db.session.query(Book).join(Book.stacks).filter(Stack.stack_description.contains(query))).order_by(Book.title)
|
|
||||||
|
|
||||||
if results.count() == 0:
|
if results.count() == 0:
|
||||||
books = Book.query.filter(Book.file.like('potential.pdf'))
|
books = Book.query.filter(Book.file.like('potential.pdf'))
|
||||||
|
Loading…
Reference in New Issue
Block a user