updates red link page
This commit is contained in:
parent
5fbdb06665
commit
0696c94a14
@ -82,6 +82,7 @@ border-spacing:0; /* Removes the cell spacing via CSS */
|
|||||||
.library_table th{
|
.library_table th{
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
background-color: #fafafa;
|
||||||
}
|
}
|
||||||
|
|
||||||
th.headerSortUp{
|
th.headerSortUp{
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div>
|
<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 method="POST" action="{{ url_for('add_book') }}" enctype=multipart/form-data>
|
||||||
{{ form.csrf_token }}
|
{{ form.csrf_token }}
|
||||||
@ -60,17 +60,76 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="padding-left:10px;">
|
<div style="padding-left:10px; padding-bottom: 50px;">
|
||||||
Category: {{ form.category(size=27, class="form-control") }}
|
Category: {{ form.category(size=27, class="form-control") }}
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
Year published: {{ form.year_published(size=8, class="form-control") }}
|
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>
|
<p><a href="{{ url_for('home') }}" style="font-size: 9pt;">go back home</a></p>
|
||||||
|
<br>
|
||||||
</div>
|
</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 %}
|
{% endblock %}
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
<li><a href="{{url_for('show_author_by_id', id=author.id)}}">{{ author.author_name }}</a> </li>
|
<li><a href="{{url_for('show_author_by_id', id=author.id)}}">{{ author.author_name }}</a> </li>
|
||||||
|
|
||||||
{% endfor %}</td>
|
{% endfor %}</td>
|
||||||
<td>{{ book.year_published }}</td>
|
<td>{{ book.year_published or '––'}}</td>
|
||||||
<td>{{ book.category}}</td>
|
<td>{{ book.category}}</td>
|
||||||
<td> {% for stack in book.stacks %}
|
<td> {% for stack in book.stacks %}
|
||||||
|
|
||||||
@ -69,8 +69,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container" >
|
<div class="container" style= "border-top: dashed; border-width: 1px;" >
|
||||||
<hr>
|
|
||||||
<h2> Other books </h2>
|
<h2> Other books </h2>
|
||||||
|
|
||||||
<table class="library_table" id="table" style="width:100%">
|
<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>
|
<li><a href="{{url_for('show_author_by_id', id=author.id)}}">{{ author.author_name }}</a> </li>
|
||||||
|
|
||||||
{% endfor %}</td>
|
{% endfor %}</td>
|
||||||
<td>{{ book.year_published }}</td>
|
<td>{{ book.year_published or '––'}}</td>
|
||||||
<td>{{ book.category}}</td>
|
<td>{{ book.category}}</td>
|
||||||
<td> {% for stack in book.stacks %}
|
<td> {% for stack in book.stacks %}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
<p>
|
<p>
|
||||||
<tbody>
|
<tbody>
|
||||||
<th>
|
<th>
|
||||||
{{ book.title }}</th>
|
{{ book.title }} ({{ book.year_published or '?' }})</th>
|
||||||
<br>
|
<br>
|
||||||
<span style = "font-size: 14px;">
|
<span style = "font-size: 14px;">
|
||||||
{% for author in book.authors %}
|
{% for author in book.authors %}
|
||||||
@ -53,8 +53,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="container" >
|
<div class="container" style= "border-top: dashed; border-width: 1px;">
|
||||||
<hr>
|
|
||||||
<h2> Other books </h2>
|
<h2> Other books </h2>
|
||||||
|
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
@ -67,7 +66,7 @@
|
|||||||
<p>
|
<p>
|
||||||
<tbody>
|
<tbody>
|
||||||
<th>
|
<th>
|
||||||
{{ book.title }}</th>
|
{{ book.title }} ({{ book.year_published or '?' }})</th>
|
||||||
<br>
|
<br>
|
||||||
<span style = "font-size: 14px;">
|
<span style = "font-size: 14px;">
|
||||||
{% for author in book.authors %}
|
{% for author in book.authors %}
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
<li><a href="{{url_for('show_author_by_id', id=author.id)}}">{{ author.author_name }}</a> </li>
|
<li><a href="{{url_for('show_author_by_id', id=author.id)}}">{{ author.author_name }}</a> </li>
|
||||||
|
|
||||||
{% endfor %}</td>
|
{% endfor %}</td>
|
||||||
<td id='fileformat'>{{ book.year_published }}</td>
|
<td id='fileformat'>{{ book.year_published or '––'}}</td>
|
||||||
<td>{{ book.category}}</td>
|
<td>{{ book.category}}</td>
|
||||||
<td>
|
<td>
|
||||||
{% for stack in book.stacks %}
|
{% for stack in book.stacks %}
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
<p>
|
<p>
|
||||||
<tbody>
|
<tbody>
|
||||||
<th>
|
<th>
|
||||||
{{ book.title }}</th>
|
{{ book.title }} ({{ book.year_published or '–' }})</th>
|
||||||
<br>
|
<br>
|
||||||
<span style = "font-size: 14px;">
|
<span style = "font-size: 14px;">
|
||||||
{% for author in book.authors %}
|
{% for author in book.authors %}
|
||||||
|
10
app/views.py
10
app/views.py
@ -387,11 +387,6 @@ def show_books():
|
|||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
newmsg = 'searched for: ' + search.search.data
|
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), {
|
socketio.emit('channel-' + str(1), {
|
||||||
'username': 'Search form',
|
'username': 'Search form',
|
||||||
'text': search.search.data,
|
'text': search.search.data,
|
||||||
@ -410,7 +405,7 @@ def show_books():
|
|||||||
@app.route('/search/<searchtype>/<viewby>/<query>', methods=['POST', 'GET'])
|
@app.route('/search/<searchtype>/<viewby>/<query>', methods=['POST', 'GET'])
|
||||||
def search_results(searchtype, query, viewby):
|
def search_results(searchtype, query, viewby):
|
||||||
search = SearchForm(request.form, search=query)
|
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)
|
results=Book.query.filter(Book.title.contains(query)).order_by(Book.title)
|
||||||
viewby = view[-1]
|
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)
|
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'))
|
||||||
upload_form = UploadForm(title= query, author='')
|
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()
|
count = results.count()
|
||||||
whole = Book.query.count()
|
whole = Book.query.count()
|
||||||
|
Loading…
Reference in New Issue
Block a user