From 23f984431b71a958301af2ec648dcc15ecc09ac9 Mon Sep 17 00:00:00 2001 From: Jonathan Sundqvist Date: Sat, 28 Nov 2020 19:10:28 +0100 Subject: [PATCH 1/4] Make the layout more similar to stimulus-reflex expo --- app/settings.py | 2 +- core/templates/base.html | 79 +++++++++++++++++++++------------------- 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/app/settings.py b/app/settings.py index b05fe71..75d3bdd 100644 --- a/app/settings.py +++ b/app/settings.py @@ -125,7 +125,7 @@ # https://docs.djangoproject.com/en/3.1/howto/static-files/ STATIC_URL = '/static/' -STATIC_ROOT = os.path.join(BASE_DIR, "static") +STATIC_ROOT = BASE_DIR / "static" CHANNEL_LAYERS = { "default": { diff --git a/core/templates/base.html b/core/templates/base.html index 886f5e8..01f0f6d 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -1,51 +1,54 @@ {% load static pygmentize %} + - - - - - - - Expo - + + + + + + + + + + Expo + - -
-
- + +
-
- {% block main %} - {% endblock %} - +

{% block subtitle %}

Django Sockpuppet

{% endblock subtitle %} + {% block main %} + {% endblock %}
- + + From 0e62e5142266bec6636fbdb2a1699da186e6c787 Mon Sep 17 00:00:00 2001 From: Jonathan Sundqvist Date: Sat, 28 Nov 2020 19:49:57 +0100 Subject: [PATCH 2/4] Add css for refactored view --- .gitignore | 3 ++- core/static/css/styles.css | 46 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 core/static/css/styles.css diff --git a/.gitignore b/.gitignore index 615fcca..9785c98 100644 --- a/.gitignore +++ b/.gitignore @@ -152,4 +152,5 @@ dmypy.json # End of https://www.toptal.com/developers/gitignore/api/django node_modules -static +/static +/core/static/dist diff --git a/core/static/css/styles.css b/core/static/css/styles.css new file mode 100644 index 0000000..290aac7 --- /dev/null +++ b/core/static/css/styles.css @@ -0,0 +1,46 @@ +header { + padding-top: 0; + margin-left: 0.5rem; +} +html { + font-size: 10px; +} +body { + font-size: 1.6rem; + height: 100%; + padding: 0; +} +aside { + padding: 0.5rem; + min-height: calc(100vh - 200px); +} +footer { + position: fixed; + right: 0; + left: 0; +} +hr { margin-top: 0; margin-bottom: 0; } +h1 { font-family: 'Open Sans', sans-serif; } +nav ul li { display: block; } + +.min-vh-100 { + min-height: 100vh !important; +} + +flex-container { display: flex; } +.flex { display: flex; } +.self-center { align-self: center; } +.leading-none { line-height: 1; } +.m-0 { margin: 0; } +.mt-0 { margin-top: 0; } +.mt-1 { margin-top: 1rem; } +.mb-0 { margin-bottom: 0; } +.mb-1 { margin-battam: 1rem; } +.pl-1 { padding-left: 1rem; } +.pr-2 { padding-right: 2rem; } +.py--5 { padding-top: 0.5rem; padding-bottom: 0.5rem;} +.py-1 { padding-top: 1rem; padding-bottom: 1rem;} + +.border-right { + border-right: 1px #AAA solid; +} From 822594941fc3ea7bfced4cd24fecb814af04559e Mon Sep 17 00:00:00 2001 From: Jonathan Sundqvist Date: Sat, 28 Nov 2020 22:49:28 +0100 Subject: [PATCH 3/4] Improve the book search view --- core/static/css/styles.css | 23 +++++++++++++++++++++++ core/templates/base.html | 2 +- core/templates/book_search.html | 6 +++--- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/core/static/css/styles.css b/core/static/css/styles.css index 290aac7..0a46d57 100644 --- a/core/static/css/styles.css +++ b/core/static/css/styles.css @@ -1,3 +1,7 @@ +:root { + --justify-important: left; +} + header { padding-top: 0; margin-left: 0.5rem; @@ -19,16 +23,35 @@ footer { right: 0; left: 0; } + +footer, +header, +main { + margin: 0 auto; + max-width: var(--width-content); + padding: 0rem 2rem; +} + hr { margin-top: 0; margin-bottom: 0; } h1 { font-family: 'Open Sans', sans-serif; } nav ul li { display: block; } +table { + width: 100%; + display: inline-table; +} + +form { + max-width: 100%; +} + .min-vh-100 { min-height: 100vh !important; } flex-container { display: flex; } .flex { display: flex; } +.flex-grow { flex-grow: 1; } .self-center { align-self: center; } .leading-none { line-height: 1; } .m-0 { margin: 0; } diff --git a/core/templates/base.html b/core/templates/base.html index 01f0f6d..55f0c21 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -36,7 +36,7 @@

-
+

{% block subtitle %}

Django Sockpuppet

{% endblock subtitle %}

{% block main %} {% endblock %} diff --git a/core/templates/book_search.html b/core/templates/book_search.html index 5969e59..f0c2bc3 100644 --- a/core/templates/book_search.html +++ b/core/templates/book_search.html @@ -31,13 +31,13 @@ - {% for book in books|slice:'0:5' %} + {% for book in books|slice:'0:10' %} - {{book.subject|join:', '|truncatechars:10}} + {{book.subject|join:', '|truncatechars:40}} {{book.title|truncatechars:30}} {{book.author_name|join:', '|truncatechars:30}} {{book.publish_year.0 }} - {{book.isbn.0|truncatechars:5}} + {{book.isbn.0|truncatechars:30}} {% endfor %} From f0467ec627e61e0987764dd45754f74b9de7ad3a Mon Sep 17 00:00:00 2001 From: Jonathan Sundqvist Date: Sat, 28 Nov 2020 22:56:27 +0100 Subject: [PATCH 4/4] Make sure that fontawesome shows up --- core/templates/base.html | 1 + 1 file changed, 1 insertion(+) diff --git a/core/templates/base.html b/core/templates/base.html index 55f0c21..793d5f4 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -7,6 +7,7 @@ +