From e0c174d9908d06728938b4066dea09f4588ae2d2 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 28 Jan 2020 17:23:38 -0800 Subject: [PATCH] Improves templates --- fedireads/migrations/0001_initial.py | 4 +- fedireads/models.py | 2 +- fedireads/static/format.css | 70 +++++++++----- fedireads/templates/book.html | 37 ++++--- fedireads/templates/edit_user.html | 2 +- fedireads/templates/feed.html | 138 ++++++++++++++------------- fedireads/templates/layout.html | 9 +- fedireads/templates/login.html | 19 +++- fedireads/templates/results.html | 2 +- fedireads/templates/user.html | 2 +- fedireads/views.py | 13 +-- 11 files changed, 166 insertions(+), 132 deletions(-) diff --git a/fedireads/migrations/0001_initial.py b/fedireads/migrations/0001_initial.py index 13fbe6356..d64e18393 100644 --- a/fedireads/migrations/0001_initial.py +++ b/fedireads/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.0.2 on 2020-01-28 23:19 +# Generated by Django 3.0.2 on 2020-01-29 01:16 from django.conf import settings import django.contrib.auth.models @@ -86,7 +86,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('activitypub_id', models.CharField(max_length=255)), - ('openlibrary_key', models.CharField(max_length=255)), + ('openlibrary_key', models.CharField(max_length=255, unique=True)), ('data', django.contrib.postgres.fields.jsonb.JSONField()), ('added_date', models.DateTimeField(auto_now_add=True)), ('updated_date', models.DateTimeField(auto_now=True)), diff --git a/fedireads/models.py b/fedireads/models.py index e77707e7e..e9814b1a6 100644 --- a/fedireads/models.py +++ b/fedireads/models.py @@ -199,7 +199,7 @@ class ShelfBook(models.Model): class Book(models.Model): ''' a non-canonical copy from open library ''' activitypub_id = models.CharField(max_length=255) - openlibrary_key = models.CharField(max_length=255) + openlibrary_key = models.CharField(max_length=255, unique=True) data = JSONField() works = models.ManyToManyField('Work') authors = models.ManyToManyField('Author') diff --git a/fedireads/static/format.css b/fedireads/static/format.css index 5f52ee6a0..a001432cc 100644 --- a/fedireads/static/format.css +++ b/fedireads/static/format.css @@ -1,23 +1,41 @@ +/* some colors that are okay: #247BA0 #70C1B2 #B2DBBF #F3FFBD #FF1654 */ * { margin: 0; padding: 0; line-height: 1.3em; overflow: auto; + font-family: sans-serif; + font-weight: normal; } -body > * > * { +h1 { + font-size: 1.2rem; +} + +h2 { + font-size: 1rem; + background-color: #F3FFBD; + padding: 0.5rem 0.2rem; + margin-bottom: 1rem; +} + +#main { margin: 0 auto; - padding: 1rem; + display: flex; + flex-flow: row wrap; max-width: 75rem; - min-width: 30rem; } #top-bar { height: 4rem; - border-bottom: 1px solid #aaa; - box-shadow: 0 0.5em 0.5em -0.6em #666; - margin-bottom: 1em; - overflow: auto; + background-color: #B2DBBF; + overflow: hidden; + padding: 0.5rem; +} + +#top-bar a { + color: black; + text-decoration: none; } #branding { @@ -33,17 +51,9 @@ header > div:last-child { } #sidebar { - width: 30%; - float: left; -} - -.carosel { - margin-bottom: 1rem; -} -.carosel > div { - display: inline-block; - margin: 0 1rem; - vertical-align: top; + display: flex; + flex-direction: column; + flex-grow: 1; } .user-pic { @@ -63,16 +73,24 @@ header > div:last-child { margin-right: 0.5em; } -.update { - border: 1px solid #333; - border-radius: 0.2rem; - margin-bottom: 1em; +#feed, #content { + display: flex; + flex-direction: column; + flex-grow: 3; } -.update > * { - padding: 1em; +#content > div, #feed > div, #sidebar > div { + background-color: #EFEFEF; + margin: 1rem auto; + padding: 1rem; + width: 90%; } -.interact { - background-color: #eee; +form label { + display: block; +} + +.review-form textarea { + width: 30rem; + height: 10rem; } diff --git a/fedireads/templates/book.html b/fedireads/templates/book.html index 35fc512dc..ebd5d57b9 100644 --- a/fedireads/templates/book.html +++ b/fedireads/templates/book.html @@ -1,19 +1,30 @@ {% extends 'layout.html' %} {% block content %} -
-
- -

{{ book.data.title }}

- by {{ book.authors.first.data.name }} - {{ rating }} stars +
+
+
+ +

{{ book.data.title }}

+ by {{ book.authors.first.data.name }} + {{ rating }} stars +
+ +

Leave a review

+ +
+ + + + + +
-
- - - - - -

Reviews

diff --git a/fedireads/templates/edit_user.html b/fedireads/templates/edit_user.html index 4c6bd938a..dc66d6558 100644 --- a/fedireads/templates/edit_user.html +++ b/fedireads/templates/edit_user.html @@ -1,6 +1,6 @@ {% extends 'layout.html' %} {% block content %} -
+