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

This commit is contained in:
Alice 2018-06-11 18:23:52 +02:00
commit 9c84e75e8c
4 changed files with 10 additions and 9 deletions

View File

@ -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')

View File

@ -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;">

View File

@ -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">&times;</span> <span class="close">&times;</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 %}

View File

@ -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'))