From 22e6b0db9eda37c3b556820ba2096353ca14558e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ku=C5=BE=C3=ADlek?= Date: Mon, 17 Feb 2020 15:25:44 +0100 Subject: [PATCH] Better styles for forms, template indentation --- yadc/static/default.scss | 21 ++++++ yadc/templates/index.html | 52 +++++++-------- yadc/templates/login.html | 39 ++++++----- yadc/templates/post.html | 102 ++++++++++++++--------------- yadc/templates/register.html | 45 +++++++------ yadc/templates/reset_password.html | 23 ++++--- yadc/templates/upload.html | 42 ++++++------ 7 files changed, 178 insertions(+), 146 deletions(-) diff --git a/yadc/static/default.scss b/yadc/static/default.scss index a9d0d30..583e87e 100644 --- a/yadc/static/default.scss +++ b/yadc/static/default.scss @@ -433,6 +433,27 @@ header { } } } + + form { + margin: 0 auto; + width: 300px; + //text-align: center; + padding: 5px; + + input { + margin: 5px 0; + //font-size: 1em; + + &:not([type=checkbox]):not([type=submit]):not([type=radio]):not([type=file]) { + width: 100%; + } + + &[type=file] { + //display: none; + } + } + } + } footer { // DUE TO OVERFLOW OF THE SIDE PANEL, TRY TO KEEP IT ON THE RIGHT diff --git a/yadc/templates/index.html b/yadc/templates/index.html index b08f63d..629b3ce 100644 --- a/yadc/templates/index.html +++ b/yadc/templates/index.html @@ -2,32 +2,32 @@ {% from '_includes.html' import render_tags, render_pagination with context %} {% block content %} -
-
- {{ render_tags() }} -
-
-
- {% for post in posts %} -
- - - -
- {% endfor %} - - +
+
+ {{ render_tags() }} +
+
+
+ {% for post in posts %} +
+ + + +
+ {% endfor %} + +
+ {{ render_pagination('post.posts') }} +
+
{% endblock content %} \ No newline at end of file diff --git a/yadc/templates/login.html b/yadc/templates/login.html index 315930c..7d461da 100644 --- a/yadc/templates/login.html +++ b/yadc/templates/login.html @@ -2,22 +2,25 @@ {% from "_formhelpers.html" import errors %} {% block content %} -

Log In

-
- {{ form.csrf_token }} -
- {{ form.username.label }} {{ form.username(size=32) }} - {{ errors(form.username) }} -
-
- {{ form.password.label }} {{ form.password(size=32) }} - {{ errors(form.password) }} -
-
- {{ form.remember_me() }} {{ form.remember_me.label }} - {{ errors(form.remember_me) }} -
-
{{ form.submit() }}
-
- Forgoten password? +
+

Log In

+ {{ form.csrf_token }} +
+ {{ form.username(placeholder="Username") }} + {{ errors(form.username) }} +
+
+ {{ form.password(placeholder="Password") }} + {{ errors(form.password) }} +
+
+ {{ form.remember_me() }} {{ form.remember_me.label }} + {{ errors(form.remember_me) }} +
+
+ {{ form.submit() }} + Forgotten password? +
+ +
{% endblock content %} \ No newline at end of file diff --git a/yadc/templates/post.html b/yadc/templates/post.html index 295db7b..ed9831f 100644 --- a/yadc/templates/post.html +++ b/yadc/templates/post.html @@ -3,59 +3,59 @@ {% from "_formhelpers.html" import errors %} {% block content %} -
-
-
- - -
Id: {{ post.id }}
-
Author: {{ post.author.username }}
- {% if post.is_approved %} -
Approved by: {{ post.approver.username }}
- {% endif %} - {% if not post.is_approved %} -
Status: {{ post.status.name.capitalize() }}
- {% endif %} -
Posted: 10 hours ago
- -
File size: {{ post.filesize_human }}
-
Image res: {{ post.image_resolution }}
- - {% if post.filetype.name == 'png' %} - - {% endif %} +
+
+
+ + +
Id: {{ post.id }}
+
Author: {{ post.author.username }}
+ {% if post.is_approved %} +
Approved by: {{ post.approver.username }}
+ {% endif %} + {% if not post.is_approved %} +
Status: {{ post.status.name.capitalize() }}
+ {% endif %} +
Posted: 10 hours ago
+ +
File size: {{ post.filesize_human }}
+
Image res: {{ post.image_resolution }}
+ + {% if post.filetype.name == 'png' %} + + {% endif %} -
- {{ render_tags() }} - {% if post.can_edit %} - {{ render_post_edit() }} - {% endif %} -
-
-
- -
-
+
+ {{ render_tags() }} + {% if post.can_edit %} + {{ render_post_edit() }} + {% endif %} +
+
+
+
-
-

Comments

- {{ render_comments() }} +
+
+
+

Comments

+ {{ render_comments() }} - {% if current_user.is_authenticated %} -
-

Reply

-
- {{ comment_form.csrf_token }} - {{ comment_form.post_id() }} -
- {{ comment_form.content(cols=55, rows=6) }} - {{ errors(comment_form.content) }} -
-
{{ comment_form.submit() }}
-
+ {% if current_user.is_authenticated %} +
+

Reply

+
+ {{ comment_form.csrf_token }} + {{ comment_form.post_id() }} +
+ {{ comment_form.content(cols=55, rows=6) }} + {{ errors(comment_form.content) }}
- {% else %} -

To comment, please log in.

- {% endif %} -
+
{{ comment_form.submit() }}
+ +
+ {% else %} +

To comment, please log in.

+ {% endif %} +
{% endblock content %} \ No newline at end of file diff --git a/yadc/templates/register.html b/yadc/templates/register.html index 664403c..48cd69c 100644 --- a/yadc/templates/register.html +++ b/yadc/templates/register.html @@ -2,25 +2,28 @@ {% from "_formhelpers.html" import errors %} {% block content %} -

Log In

-
- {{ form.csrf_token }} -
- {{ form.username.label }} {{ form.username(size=32) }} - {{ errors(form.username) }} -
-
- {{ form.email.label }} {{ form.email(size=32) }} - {{ errors(form.email) }} -
-
- {{ form.password.label }} {{ form.password(size=32) }} - {{ errors(form.password) }} -
-
- {{ form.password_again.label }} {{ form.password_again(size=32) }} - {{ errors(form.password_again) }} -
-
{{ form.submit() }}
-
+
+

Sign Up

+ {{ form.csrf_token }} +
+ {{ form.username(placeholder="Username") }} + {{ errors(form.username) }} +
+
+ {{ form.email(placeholder="Email address") }} + {{ errors(form.email) }} +
+
+ {{ form.password(placeholder="Password") }} + {{ errors(form.password) }} +
+
+ {{ form.password_again(placeholder="Repeat password") }} + {{ errors(form.password_again) }} +
+
+ {{ form.submit() }} + Already registered? +
+
{% endblock content %} \ No newline at end of file diff --git a/yadc/templates/reset_password.html b/yadc/templates/reset_password.html index 0ac2e78..316af1d 100644 --- a/yadc/templates/reset_password.html +++ b/yadc/templates/reset_password.html @@ -2,13 +2,18 @@ {% from "_formhelpers.html" import errors %} {% block content %} -

Log In

-
- {{ form.csrf_token }} -
- {{ form.email.label }} {{ form.email(size=32) }} - {{ errors(form.email) }} -
-
{{ form.submit() }}
-
+
+

Reset password

+

+ Please insert your email address and we will send you a request for password reset. +

+ {{ form.csrf_token }} +
+ {{ form.email(placeholder="Your email address") }} + {{ errors(form.email) }} +
+
+ {{ form.submit() }} +
+
{% endblock content %} \ No newline at end of file diff --git a/yadc/templates/upload.html b/yadc/templates/upload.html index 416ed5f..e7d368a 100644 --- a/yadc/templates/upload.html +++ b/yadc/templates/upload.html @@ -2,25 +2,25 @@ {% from "_formhelpers.html" import errors %} {% block content %} -

Upload image

-
- {{ form.csrf_token }} -
- {{ form.post_img.label }} {{ form.post_img() }} - {{ errors(form.post_img) }} -
-
- {{ form.sauce.label }} {{ form.sauce() }} - {{ errors(form.sauce) }} -
-
- {{ form.tags.label }} {{ form.tags() }} - {{ errors(form.tags) }} -
-
- {{ form.rating.label }} {% for r in form.rating %}{{ r.label }}{{ r() }}{% endfor %} - {{ errors(form.rating) }} -
-
{{ form.submit() }}
-
+
+

Upload post

+ {{ form.csrf_token }} +
+ {{ form.post_img.label }} {{ form.post_img() }} + {{ errors(form.post_img) }} +
+
+ {{ form.sauce(placeholder="Source URL") }} + {{ errors(form.sauce) }} +
+
+ {{ form.tags(placeholder="Tags") }} + {{ errors(form.tags) }} +
+
+ {{ form.rating.label }} {% for r in form.rating %}{{ r.label }}{{ r() }}{% endfor %} + {{ errors(form.rating) }} +
+
{{ form.submit() }}
+
{% endblock content %} \ No newline at end of file