From 3296a2efcf20467d00b6749b2aefb354d6d4832c Mon Sep 17 00:00:00 2001 From: nberting Date: Thu, 7 Jun 2018 23:33:22 +0200 Subject: [PATCH] updates to grid and list view --- app/forms.py | 7 +++++-- app/templates/results.html | 8 ++++---- app/templates/results_grid.html | 2 +- app/templates/show_books.html | 8 ++++---- app/templates/show_books_grid.html | 18 ++++++++++++++++-- 5 files changed, 30 insertions(+), 13 deletions(-) diff --git a/app/forms.py b/app/forms.py index 81508e1..f1704ab 100755 --- a/app/forms.py +++ b/app/forms.py @@ -3,7 +3,7 @@ from wtforms import StringField, FileField, validators from wtforms.validators import InputRequired, DataRequired from wtforms import FieldList from wtforms import Form as NoCsrfForm -from wtforms.fields import StringField, FormField, SubmitField, SelectField +from wtforms.fields import StringField, FormField, SubmitField, SelectField, RadioField from app.models import Book, BookSchema, Author, Stack, StackSchema # - - - Forms - - - @@ -49,9 +49,12 @@ class SearchForm(FlaskForm): ('Author', 'Author'), ('Category', 'Category'), ('Stack', 'Stack')] - select = SelectField('', choices=choices) + select = SelectField('', choices=choices, default='All') search = StringField('', validators=[InputRequired()]) grid = SubmitField('Grid') listview = SubmitField('List') + randomize = SubmitField('Order differently') + + diff --git a/app/templates/results.html b/app/templates/results.html index 54f4546..6ccb272 100644 --- a/app/templates/results.html +++ b/app/templates/results.html @@ -9,7 +9,7 @@ {{ render_field(form.search) }}


- {{ form.grid(style="font-size:20px")}}{{ form.listview(style="font-size:20px")}}

+ {{ form.grid(style="font-size:20px")}}{{ form.listview(style="font-size:20px")}}

@@ -33,7 +33,7 @@ - + @@ -45,7 +45,7 @@ {% for book in books %} +
- {{ book.title }} {% for author in book.authors %} @@ -75,7 +75,7 @@ - + diff --git a/app/templates/results_grid.html b/app/templates/results_grid.html index cea341b..5b2a1ec 100644 --- a/app/templates/results_grid.html +++ b/app/templates/results_grid.html @@ -36,7 +36,7 @@
- +

diff --git a/app/templates/show_books.html b/app/templates/show_books.html index 258c0e6..69be928 100755 --- a/app/templates/show_books.html +++ b/app/templates/show_books.html @@ -9,7 +9,7 @@ {{ render_field(form.search) }}


- {{ form.grid(style="font-size:20px")}}{{ form.listview(style="font-size:20px")}}

+ {{ form.grid(style="font-size:20px")}}{{ form.listview(style="font-size:20px")}}

All Books

@@ -28,7 +28,7 @@
- + @@ -38,11 +38,11 @@ - {% for book in books|sort(attribute='title', reverse = False) %} + {% for book in books %}
- +