added description next to each stack tab

master
Alice 7 years ago
parent cc191859bd
commit ba58a895fb

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

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

@ -294,15 +294,22 @@ def add_stack():
flash("%s stack created" % (stack_name)) flash("%s stack created" % (stack_name))
return render_template('add_stack.html', stacks=stacks, form=form) 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']) @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) stack = Stack.query.get(id)
if not stack: if not stack:
abort (404) abort (404)
else: else:
if is_tab == False:
return render_template('show_stack_detail.html', stack=stack) return render_template('show_stack_detail.html', stack=stack)
else:
return render_template('show_stack_detail_tab.html', stack=stack)
## search ## search

Loading…
Cancel
Save