added description next to each stack tab

This commit is contained in:
Alice 2018-06-03 16:30:16 +02:00
parent cc191859bd
commit ba58a895fb
3 changed files with 12 additions and 11 deletions

View File

@ -1,3 +1,4 @@
{% extends 'base.html' %}
{% block main %}
<div class="container">
@ -5,13 +6,7 @@
<h1 class="header">{{ stack.stack_name }}</h1>
<p>Stack description:
{% for stack in stacks %}
<a href="{{url_for('show_stack_by_id', id=stack.id)}}">{{ stack.stack_description }}</a>
{% endfor %}
</p>
<p>Stack description: {{ stack.stack_description }} </p>
<p>Books in this stack: {% for book in stack.books %}
<li> <a href="{{url_for('show_book_by_id', id=book.id)}}">{{book.title}}</a> </li>

View File

@ -11,8 +11,7 @@
<ul>
{% for stack in stacks %}
<li> <a href="stacks/{{ stack.id }}">{{ stack.stack_name }}</a></td>
<li> <a href="stacks/tab/{{ stack.id }}">{{ stack.stack_name }}</a></td>

View File

@ -294,15 +294,22 @@ def add_stack():
flash("%s stack created" % (stack_name))
return render_template('add_stack.html', stacks=stacks, form=form)
@app.route('/stacks/tab/<int:id>', methods=['POST', 'GET'])
def show_stack_in_tab(id):
return show_stack_by_id(id, is_tab=True)
@app.route('/stacks/<int:id>', methods=['POST', 'GET'])
def show_stack_by_id(id):
def show_stack_by_id(id, is_tab=False):
stack = Stack.query.get(id)
if not stack:
abort (404)
else:
if is_tab == False:
return render_template('show_stack_detail.html', stack=stack)
else:
return render_template('show_stack_detail_tab.html', stack=stack)
## search