From 0696c94a147032a0cbbd38fed201166c7f656d5e Mon Sep 17 00:00:00 2001 From: nberting Date: Sat, 9 Jun 2018 19:27:55 +0200 Subject: [PATCH] updates red link page --- app/static/css/style.css | 1 + app/templates/red_link.html | 65 ++++++++++++++++++++++++++++-- app/templates/results.html | 7 ++-- app/templates/results_grid.html | 9 ++--- app/templates/show_books.html | 2 +- app/templates/show_books_grid.html | 2 +- app/views.py | 10 ++--- 7 files changed, 75 insertions(+), 21 deletions(-) diff --git a/app/static/css/style.css b/app/static/css/style.css index fc8faab..1753ba4 100755 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -82,6 +82,7 @@ border-spacing:0; /* Removes the cell spacing via CSS */ .library_table th{ font-size: 20px; cursor: pointer; +background-color: #fafafa; } th.headerSortUp{ diff --git a/app/templates/red_link.html b/app/templates/red_link.html index c15e812..22f101d 100755 --- a/app/templates/red_link.html +++ b/app/templates/red_link.html @@ -37,7 +37,7 @@
-

Add this potential book:

+

Add this book:

{{ form.csrf_token }} @@ -60,17 +60,76 @@
-
+
Category: {{ form.category(size=27, class="form-control") }}

Year published: {{ form.year_published(size=8, class="form-control") }} +

{{ form.file }} {{ form.upload }} {{ form.wish }}
-

go back home

+
+
+
+

More potential books

+ + + + + + + + + + + + + + {% for book in books %} + + + + + + + + + + + + {% endfor %} + +
+ + + + {{ book.title }} {% for author in book.authors %} + +
  • {{ author.author_name }}
  • + + {% endfor %}
    {{ book.year_published }}{{ book.category}} + {% for stack in book.stacks %} + +
  • + + {{ stack.stack_name }} +
  • + + {% endfor %} + + +
    + + ===> +
    + {% endblock %} diff --git a/app/templates/results.html b/app/templates/results.html index 9ba0595..8e88967 100644 --- a/app/templates/results.html +++ b/app/templates/results.html @@ -53,7 +53,7 @@
  • {{ author.author_name }}
  • {% endfor %} - {{ book.year_published }} + {{ book.year_published or '––'}} {{ book.category}} {% for stack in book.stacks %} @@ -69,8 +69,7 @@
    -
    -
    +

    Other books

    @@ -94,7 +93,7 @@
  • {{ author.author_name }}
  • {% endfor %} - + +{{ book.title }} ({{ book.year_published or '?' }})
    {% for author in book.authors %} @@ -53,8 +53,7 @@ -
    -
    +

    Other books

    @@ -67,7 +66,7 @@

    +{{ book.title }} ({{ book.year_published or '?' }})
    {% for author in book.authors %} diff --git a/app/templates/show_books.html b/app/templates/show_books.html index ac9a819..fc4c1da 100755 --- a/app/templates/show_books.html +++ b/app/templates/show_books.html @@ -56,7 +56,7 @@
  • {{ author.author_name }}
  • {% endfor %} -
    + +{{ book.title }} ({{ book.year_published or '–' }})
    {% for author in book.authors %} diff --git a/app/views.py b/app/views.py index ec86fd7..1cf4a11 100755 --- a/app/views.py +++ b/app/views.py @@ -387,11 +387,6 @@ def show_books(): if request.method == 'POST': newmsg = 'searched for: ' + search.search.data - # message = search.search.data - # newmessage = Chat(message) - # db.session.add(newmessage) - # db.session.commit() - # Send search to socket chat socketio.emit('channel-' + str(1), { 'username': 'Search form', 'text': search.search.data, @@ -410,7 +405,7 @@ def show_books(): @app.route('/search///', methods=['POST', 'GET']) def search_results(searchtype, query, viewby): search = SearchForm(request.form, search=query) - random_order=Book.query.order_by(func.random()).limit(14) + random_order=Book.query.all() results=Book.query.filter(Book.title.contains(query)).order_by(Book.title) viewby = view[-1] @@ -436,8 +431,9 @@ def search_results(searchtype, query, viewby): results=results.union(db.session.query(Book).join(Book.stacks).filter(Stack.stack_description.contains(query))).order_by(Book.title) if results.count() == 0: + books = Book.query.filter(Book.file.like('potential.pdf')) upload_form = UploadForm(title= query, author='') - return render_template('red_link.html', form=upload_form, title=query) + return render_template('red_link.html', form=upload_form, title=query, books=books) count = results.count() whole = Book.query.count()
    {{ book.year_published }}{{ book.year_published or '––'}} {{ book.category}} {% for stack in book.stacks %} diff --git a/app/templates/results_grid.html b/app/templates/results_grid.html index 5b2a1ec..d043c4a 100644 --- a/app/templates/results_grid.html +++ b/app/templates/results_grid.html @@ -30,7 +30,7 @@ {% endif %} {% endwith %} -
    +
    {% for book in books|sort(attribute='title', reverse = False) %} @@ -41,7 +41,7 @@

    -{{ book.title }}
    -{{ book.title }} {{ book.year_published }}{{ book.year_published or '––'}} {{ book.category}} {% for stack in book.stacks %} diff --git a/app/templates/show_books_grid.html b/app/templates/show_books_grid.html index 4384ee8..cc2c2f3 100644 --- a/app/templates/show_books_grid.html +++ b/app/templates/show_books_grid.html @@ -38,7 +38,7 @@

    -{{ book.title }}