Merge branch 'master' of git.xpub.nl:/var/www/git.xpub.nl/repos/xpub-lib

master
Alice 7 years ago
commit 9c84e75e8c

@ -76,7 +76,8 @@ class SearchForm(FlaskForm):
('Title', 'Title'),
('Author', 'Author'),
('Category', 'Category'),
('Stack', 'Stack')]
('Stack', 'Stack'),
('Outliers', 'Outliers')]
select = SelectField('', choices=choices, default='All')
search = StringField('', validators=[InputRequired()])
grid = SubmitField('Grid')

@ -60,19 +60,16 @@
</table>
</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") }}
<br>
<br>
Year published: {{ form.year_published(size=8, class="form-control") }}
<br>
<br>
{{ form.file }}
{{ form.upload }}
{{ form.wish }}
</form>
<br>
<p><a href="{{ url_for('home') }}" style="font-size: 9pt;">go back home</a></p>
<br>
</div>
<div class= "Container" style= "border-top: dashed; border-width: 1px;">

@ -63,6 +63,7 @@
</tbody>
</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>
<br>
@ -93,7 +94,7 @@
<div class="modal-content">
<span class="close">&times;</span>
<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>
</div>
{% else %}

@ -525,14 +525,16 @@ def search_results(searchtype, query, viewby):
if searchtype== 'Stack':
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':
# results=Book.query.whoosh_search(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.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.stacks).filter(Stack.stack_name.contains(query)))
results=results.union(db.session.query(Book).join(Book.stacks).filter(Stack.stack_description.contains(query))).order_by(Book.title)
results=results.union(db.session.query(Book).join(Book.stacks).filter(Stack.stack_name.contains(query))).order_by(Book.title)
if results.count() == 0:
books = Book.query.filter(Book.file.like('potential.pdf'))

Loading…
Cancel
Save