added stack length limit and ascii in catalog view

geo
Alice 7 years ago
parent 644ed7d621
commit ff507913e2

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

@ -59,10 +59,17 @@
{% endfor %}</td> {% endfor %}</td>
<td id='fileformat'>{{ book.year_published or ''}}</td> <td id='fileformat'>{{ book.year_published or ''}}</td>
<td>{{ book.category}}</td> <td>{{ book.category}}</td>
<td> <td id='ascii'>
{% for stack in book.stacks %} {% for stack in book.stacks %}
<li><a href="{{url_for('show_stack_by_id', id=stack.id)}}"> {{ stack.stack_name }} </a></li> <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 %} {% endfor %}

@ -13,19 +13,32 @@
{{ stack.stack_author }} {{ stack.stack_author }}
{% endif %} {% endif %}
<h2>Books in this stack:</h2> <h2>Books in this stack:</h2>
<p> <p>
{% for book in stack.books %} {% 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> <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';"> <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'> <div class='widget'>
<iframe src="../uploads/{{ book.file }}" width="50%" ></iframe> <iframe src="../uploads/{{ book.file }}" width="50%" ></iframe>
</div> </div>
{% endfor %}</p> {% endfor %}</p>
<br> <br>
<br> <br>
<p><a href="{{url_for('show_books')}}">Add some more books</a></p>
<p> <p>
<a href="{{ url_for('remove_stack_by_id', id=stack.id )}}">Remove stack</a> </p> <a href="{{ url_for('remove_stack_by_id', id=stack.id )}}">Remove stack</a> </p>
<p> <p>

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

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

Loading…
Cancel
Save