From 59cbba9d035d7253928e825ffc61e218cafa26be Mon Sep 17 00:00:00 2001 From: xemeds Date: Wed, 19 Aug 2020 16:31:22 +0300 Subject: [PATCH] Cleaned up the templates --- tiny0/forms.py | 2 +- tiny0/static/style.css | 2 +- tiny0/templates/donate.html | 19 ++++------ tiny0/templates/error.html | 15 +++----- tiny0/templates/index.html | 70 +++++++------------------------------ tiny0/templates/layout.html | 63 +++++++++++++++++++++++++++++++++ tiny0/templates/url.html | 26 +++----------- 7 files changed, 93 insertions(+), 104 deletions(-) diff --git a/tiny0/forms.py b/tiny0/forms.py index bd848cb..914cbd6 100644 --- a/tiny0/forms.py +++ b/tiny0/forms.py @@ -32,7 +32,7 @@ def validate_URL(form, field): # If the url contains the websites domain if WEBSITE_DOMAIN in field.data.lower(): # Raise a ValidationError - raise ValidationError("Yeah, that's definitely a valid URL") + raise ValidationError("Invalid URL") # If the URL does not start with http:// and https:// if not(field.data.lower().startswith("http://")) and not(field.data.lower().startswith("https://")): diff --git a/tiny0/static/style.css b/tiny0/static/style.css index e6a86d4..ec2ded1 100644 --- a/tiny0/static/style.css +++ b/tiny0/static/style.css @@ -119,7 +119,7 @@ body { margin-bottom: 2vh; } -.donation h3 { +.donation h4 { margin-bottom: 4vh; } diff --git a/tiny0/templates/donate.html b/tiny0/templates/donate.html index 27b04d6..03a917b 100644 --- a/tiny0/templates/donate.html +++ b/tiny0/templates/donate.html @@ -1,17 +1,10 @@ {% extends "layout.html" %} {% block body %} - -
- tiny0 -

Custom URL Shortener

-
- - - + {% endblock %} diff --git a/tiny0/templates/error.html b/tiny0/templates/error.html index dfce0d6..2b9148b 100644 --- a/tiny0/templates/error.html +++ b/tiny0/templates/error.html @@ -1,15 +1,8 @@ {% extends "layout.html" %} {% block body %} - -
- tiny0 -

Custom URL Shortener

-
- - - + {% endblock %} \ No newline at end of file diff --git a/tiny0/templates/index.html b/tiny0/templates/index.html index eaa9d9b..0fe832c 100644 --- a/tiny0/templates/index.html +++ b/tiny0/templates/index.html @@ -1,62 +1,18 @@ {% extends "layout.html" %} {% block body %} - {% if form.url.errors %} - -
- tiny0 -

Custom URL Shortener

+
+
+ {{ form.hidden_tag() }} +
+ {{ form.url(placeholder="Enter the URL here", autofocus=true, class="url") }} + {{ form.submit(class="button") }}
- {% else %} - -
- -

-
- {% endif %} - -
- - {{ form.hidden_tag() }} -
- {{ form.url(placeholder="Enter the URL here", autofocus=true, class="url") }} - {{ form.submit(class="button") }} -
- {% if form.url.errors %} - {% for error in form.url.errors %} -

{{ error }}

- {% endfor %} - {% endif %} - -
- - {% if not form.url.errors %} - - {% endif %} - + {% if form.url.errors %} + {% for error in form.url.errors %} +

{{ error }}

+ {% endfor %} + {% endif %} + +
{% endblock %} diff --git a/tiny0/templates/layout.html b/tiny0/templates/layout.html index 3d24d5b..069c673 100644 --- a/tiny0/templates/layout.html +++ b/tiny0/templates/layout.html @@ -13,7 +13,70 @@
+ {% if form %} + {% if not form.url.errors %} + +
+ +

+
+ {% else %} + +
+ tiny0 +

Custom URL Shortener

+
+ {% endif %} + {% else %} + +
+ tiny0 +

Custom URL Shortener

+
+ {% endif %} + {% block body %}{% endblock %} + + {% if form %} + {% if not form.url.errors %} + + {% endif %} + {% elif url %} + + {% endif %} +
diff --git a/tiny0/templates/url.html b/tiny0/templates/url.html index c415b0d..386f8c7 100644 --- a/tiny0/templates/url.html +++ b/tiny0/templates/url.html @@ -1,26 +1,10 @@ {% extends "layout.html" %} {% block body %} - -
- tiny0 -

Custom URL Shortener

+
+
+ +
- -
-
- - -
-
- - - +
{% endblock %}