diff --git a/app/forms.py b/app/forms.py index f652c5c..5db22e4 100755 --- a/app/forms.py +++ b/app/forms.py @@ -34,6 +34,9 @@ class StackForm(FlaskForm): stack_description = StringField('Description', validators=[InputRequired()]) create = SubmitField(label='Create') +class AddtoStackForm(FlaskForm): + select = SelectField('Stacks', validators=[InputRequired()]) + class SearchForm(FlaskForm): choices = [('All', 'All'), ('Title', 'Title'), diff --git a/app/static/css/style.css b/app/static/css/style.css index 35ad7b1..e91c4a7 100755 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -97,10 +97,17 @@ background-color: #E8E8E8!important; .library_table li{ list-style-type:none; +text-align: center; padding-right: 5px; display: inline-block; } +#plus { + text-align: center; + font-size: 10px; +} + + .library_table tr:nth-child(even){ background-color: #fafafa; } diff --git a/app/templates/add_stack.html b/app/templates/add_stack.html new file mode 100644 index 0000000..9638f91 --- /dev/null +++ b/app/templates/add_stack.html @@ -0,0 +1,36 @@ +{% extends 'base.html' %} + +{% block main %} +
+ + + +
+ {{form.hidden_tag()}} +
+{{ render_field(form.stack_name)}} +{{ render_field(form.stack_description)}} + + + + +
+ + + + +
+{% endblock %} diff --git a/app/templates/add_to_stacks.html b/app/templates/add_to_stacks.html new file mode 100644 index 0000000..7576cbd --- /dev/null +++ b/app/templates/add_to_stacks.html @@ -0,0 +1,44 @@ +{% extends 'base.html' %} + +{% block main %} +
+ +
Chosen book: + +

{{ book.title }}

+ + +
+

These are all the stacks that have been built so far.

+ + + + + + + +
+
+

Build a stack

+ +

Add Stack

+ +
+

List of books

+
+ +
+

Stack

+
+ + + +{% endblock %} diff --git a/app/templates/show_books.html b/app/templates/show_books.html index 7aa0a2c..27f539a 100755 --- a/app/templates/show_books.html +++ b/app/templates/show_books.html @@ -32,6 +32,7 @@ + @@ -58,7 +59,18 @@
  • {{ stack.stack_name }}
  • {% endfor %} - + + + {% endfor %} diff --git a/app/templates/show_stack_detail_tab.html b/app/templates/show_stack_detail_tab.html new file mode 100644 index 0000000..c8f703a --- /dev/null +++ b/app/templates/show_stack_detail_tab.html @@ -0,0 +1,18 @@ +{% block main %} +
    + +

    {{ stack.stack_name }}

    + + +

    Stack description: {{ stack.stack_description }}

    + +

    Books in this stack: {% for book in stack.books %} + +

  • {{book.title}}
  • + + {% endfor %}

    + + + +
    +{% endblock %} diff --git a/app/views.py b/app/views.py index 37598db..862bd12 100755 --- a/app/views.py +++ b/app/views.py @@ -9,7 +9,7 @@ from app import app, db, socketio, DOMAIN from flask import Flask, Response, render_template, request, redirect, url_for, flash, send_from_directory, jsonify, abort import json from sqlalchemy.sql.expression import func, select -from app.forms import UploadForm, EditForm, SearchForm, ChatForm, StackForm +from app.forms import UploadForm, EditForm, SearchForm, ChatForm, StackForm, AddtoStackForm from app.models import Book, BookSchema, Author, AuthorSchema, Stack, StackSchema, UserIns, Chat, ChatSchema from app.cover import get_cover from os import environ @@ -267,8 +267,7 @@ def show_stacks(): def add_stack(): form = StackForm() stacks = db.session.query(Stack).all() - #if request.method == 'GET': - # return render_template('add_stack.html', stacks=stacks, form=form) + if request.method == 'POST': stack_name = form.stack_name.data stack_description = form.stack_description.data @@ -372,6 +371,14 @@ def test1(): return Response(json.dumps(autocomplete_suggestions), mimetype='application/json') +@app.route('/add_to_stack/') + +def add_to_stack(id): + stacks = db.session.query(Stack).all() + book = Book.query.get(id) + add = AddtoStackForm(request.form) + + return render_template('add_to_stacks.html', id=id, stacks=stacks, book=book, add=add) ### # The API
    Filetype Category StackAdd to stack
    + + \│/
    + ─ ─
    + /│\
    + + + + +