added stack length limit and ascii in catalog view

master
Alice 7 years ago
parent 644ed7d621
commit ff507913e2

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

@ -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 %}

@ -13,19 +13,32 @@
{{ 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>

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

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

Loading…
Cancel
Save