added stack length limit and ascii in catalog view

This commit is contained in:
Alice 2018-06-11 16:56:34 +02:00
parent 644ed7d621
commit ff507913e2
5 changed files with 31 additions and 12 deletions

View File

@ -121,6 +121,10 @@ display: inline-block;
font-size: 10px;
}
#ascii {
text-align: center;
}
.library_table tr:nth-child(even){
background-color: #fafafa;

View File

@ -3,7 +3,7 @@
{% block main %}
<div class="container">
{% from "_formhelpers.html" import render_field %}
<form method="POST">
<div>{{ form.select(style="width: 100px; margin: 10px; float: left; font-size: 20px") }}</div>
<div class="search">
@ -59,10 +59,17 @@
{% endfor %}</td>
<td id='fileformat'>{{ book.year_published or ''}}</td>
<td>{{ book.category}}</td>
<td>
<td id='ascii'>
{% for stack in book.stacks %}
<li><a href="{{url_for('show_stack_by_id', id=stack.id)}}"> {{ stack.stack_name }} </a></li>
{% else %}
<li style='font-size:10px;'>
|----------| <br>
|----------| <br>
|----------| <br>
{% endfor %}

View File

@ -6,26 +6,39 @@
<h1 class="header">{{ stack.stack_name }}</h1>
<p>{{ stack.stack_description }} </p>
<p id='creator'>Created by:
<p id='creator'>Created by:
{% if stack.stack_author == None %} anon</p>
{% else %}
{{ stack.stack_author }}
{% endif %}
<h2>Books in this stack:</h2>
<p>
{% for book in stack.books %}
{% if loop.length >= 5 %}
{% if loop.index == 6 %}
<p style='color:red;'>Your stack is getting a little too big. Are these next books really relevant?</p>
<br>
<br>
{% endif %}
{% endif %}
<li> <a href="{{url_for('show_book_by_id', id=book.id)}}">{{book.title}}</a> </li>
<img class="no_cover" id="{{ book.title }}" src="../uploads/cover/{{ book.cover }}" width="150" onerror="if (this.src != '../uploads/cover/{{ book.cover }}') this.src = '../static/img/default_cover.gif';">
<div class='widget'>
<iframe src="../uploads/{{ book.file }}" width="50%" ></iframe>
</div>
{% endfor %}</p>
<br>
<br>
<p><a href="{{url_for('show_books')}}">Add some more books</a></p>
<p>
<a href="{{ url_for('remove_stack_by_id', id=stack.id )}}">Remove stack</a> </p>
<p>

View File

@ -17,17 +17,12 @@
{{ stack.stack_author }}
{% endif %}
<p style='font-weight:bold;'>Books in this stack: {% for book in stack.books %}
<p style='font-weight:bold;'>Books in this stack: {% for book in stack.books %} </p>
<li style="font-size: 18px;"> <a href="{{url_for('show_book_by_id', id=book.id)}}">{{book.title}}</a> </li>
<p style="font-size: 10px;"><a href='{{url_for('add_to_stack', id=book.id)}}'>
Add to another stack
</a></p>
{% endfor %}</p>
<p style="font-size: 10px;"><a href='{{url_for('add_to_stack', id=book.id)}}'> Add to another stack </a></p>
{% endfor %}
</div>

View File

@ -393,7 +393,7 @@ def show_stack_by_id(id, is_tab=False):
stack = Stack.query.get(id)
if not stack:
abort (404)
return render_template('add_stack.html', stacks=stacks, form=form)
else:
if is_tab == False:
return render_template('show_stack_detail.html', stack=stack)