updates red link page

This commit is contained in:
nberting 2018-06-09 19:27:55 +02:00
parent 5fbdb06665
commit 0696c94a14
7 changed files with 75 additions and 21 deletions

View File

@ -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{

View File

@ -37,7 +37,7 @@
</div>
<br>
<div>
<h2>Add this potential book:</h2>
<h2>Add this book:</h2>
<form method="POST" action="{{ url_for('add_book') }}" enctype=multipart/form-data>
{{ form.csrf_token }}
@ -60,17 +60,76 @@
</table>
</div>
</div>
<div style="padding-left:10px;">
<div style="padding-left:10px; padding-bottom: 50px;">
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>
<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;">
<h2> More potential books </h2>
<table class="library_table" id="table" style="width:100%">
<thead>
<tr id="header">
<th width="70px;">Cover</th>
<th>Title</th>
<th width="400px;">Author</th>
<th width="100px;">Year</th>
<th width="100px;">Category</th>
<th width="100px;">Stack</th>
<th width="100px;">Add to a stack</th>
</tr>
</thead>
<tbody>
{% for book in books %}
<tr>
<td style= "padding: 5px;">
<img class="no_cover" id="{{ book.title }}" src="/uploads/cover/{{ book.cover }}" width="70" onerror="if (this.src != '//uploads/cover/{{ book.cover }}') this.src = '/static/img/default_cover.gif';">
<!-- <object class="no_cover" data="../static/img/default_cover.png" type="image/png" width="65">
<p hidden="True"></p>
</object>-->
</td>
<td class="title_col"><a href="/books/{{ book.id }}">{{ book.title }}</a></td>
<td class="author_col"> {% for author in book.authors %}
<li><a href="{{url_for('show_author_by_id', id=author.id)}}">{{ author.author_name }}</a> </li>
{% endfor %}</td>
<td id='fileformat'>{{ book.year_published }}</td>
<td>{{ book.category}}</td>
<td>
{% for stack in book.stacks %}
<li><a href="{{url_for('show_stack_by_id', id=stack.id)}}"> </a>
{{ stack.stack_name }}
</li>
{% endfor %}
</td>
<td id='plus'><a href="{{url_for('add_to_stack', id=book.id)}}">
===>
</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}

View File

@ -53,7 +53,7 @@
<li><a href="{{url_for('show_author_by_id', id=author.id)}}">{{ author.author_name }}</a> </li>
{% endfor %}</td>
<td>{{ book.year_published }}</td>
<td>{{ book.year_published or ''}}</td>
<td>{{ book.category}}</td>
<td> {% for stack in book.stacks %}
@ -69,8 +69,7 @@
</div>
<div class="container" >
<hr>
<div class="container" style= "border-top: dashed; border-width: 1px;" >
<h2> Other books </h2>
<table class="library_table" id="table" style="width:100%">
@ -94,7 +93,7 @@
<li><a href="{{url_for('show_author_by_id', id=author.id)}}">{{ author.author_name }}</a> </li>
{% endfor %}</td>
<td>{{ book.year_published }}</td>
<td>{{ book.year_published or ''}}</td>
<td>{{ book.category}}</td>
<td> {% for stack in book.stacks %}

View File

@ -30,7 +30,7 @@
</div>
{% endif %}
{% endwith %}
<div class="grid">
<div class="grid" >
{% for book in books|sort(attribute='title', reverse = False) %}
@ -41,7 +41,7 @@
<p>
<tbody>
<th>
{{ book.title }}</th>
{{ book.title }} ({{ book.year_published or '?' }})</th>
<br>
<span style = "font-size: 14px;">
{% for author in book.authors %}
@ -53,8 +53,7 @@
</div>
<div class="container" >
<hr>
<div class="container" style= "border-top: dashed; border-width: 1px;">
<h2> Other books </h2>
<div class="grid">
@ -67,7 +66,7 @@
<p>
<tbody>
<th>
{{ book.title }}</th>
{{ book.title }} ({{ book.year_published or '?' }})</th>
<br>
<span style = "font-size: 14px;">
{% for author in book.authors %}

View File

@ -56,7 +56,7 @@
<li><a href="{{url_for('show_author_by_id', id=author.id)}}">{{ author.author_name }}</a> </li>
{% endfor %}</td>
<td id='fileformat'>{{ book.year_published }}</td>
<td id='fileformat'>{{ book.year_published or ''}}</td>
<td>{{ book.category}}</td>
<td>
{% for stack in book.stacks %}

View File

@ -38,7 +38,7 @@
<p>
<tbody>
<th>
{{ book.title }}</th>
{{ book.title }} ({{ book.year_published or '' }})</th>
<br>
<span style = "font-size: 14px;">
{% for author in book.authors %}

View File

@ -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/<searchtype>/<viewby>/<query>', 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()