Browse Source

added stack length limit and ascii in catalog view

ansible-setup-and-deploy
Alice 6 years ago
parent
commit
ff507913e2
  1. 4
      app/static/css/style.css
  2. 11
      app/templates/show_books.html
  3. 15
      app/templates/show_stack_detail.html
  4. 11
      app/templates/show_stack_detail_tab.html
  5. 2
      app/views.py

4
app/static/css/style.css

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

11
app/templates/show_books.html

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

15
app/templates/show_stack_detail.html

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

11
app/templates/show_stack_detail_tab.html

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

2
app/views.py

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