Skip to content

Commit

Permalink
ci: run manage.py validate_templates and djlint
Browse files Browse the repository at this point in the history
  • Loading branch information
danihodovic committed May 21, 2024
1 parent 677ee0e commit e9b5f8f
Show file tree
Hide file tree
Showing 23 changed files with 356 additions and 349 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ jobs:
source .venv/bin/activate
./manage.py validate_templates
- name: Django Template/Html Lint (djlint)
run: |
source .venv/bin/activate
djlint . --check
test:
name: Test
runs-on: ubuntu-latest
Expand Down
23 changes: 10 additions & 13 deletions allauth_ui/templates/account/_button.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
{% with base_color=base_color|default:"bg-blue" %}
<button type="submit" class="flex items-center justify-center w-64 h-12 px-6 mt-8 text-lg text-white uppercase {{ base_color }}-600 rounded text-bold hover:{{ base_color }}-700">
<svg class="hidden w-5 h-5 mr-3 animate-spin" viewBox="0 0 24 24">
<path
className="opacity-25"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
></path>
</svg>
{{ text }}

<script>
<button type="submit"
class="flex items-center justify-center w-64 h-12 px-6 mt-8 text-lg text-white uppercase {{ base_color }}-600 rounded text-bold hover:{{ base_color }}-700">
<svg class="hidden w-5 h-5 mr-3 animate-spin" viewBox="0 0 24 24">
<path className="opacity-25" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
</path>
</svg>
{{ text }}
<script>
const script = document.currentScript;
const button = script.parentElement;
const form = button.closest("form");
Expand All @@ -36,6 +33,6 @@
loader.classList.toggle("hidden");
}, 3000);
}, true);
</script>
</button>
</script>
</button>
{% endwith %}
7 changes: 4 additions & 3 deletions allauth_ui/templates/account/_links.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div class="flex justify-center mt-6 text-xs">
<a class="text-blue-400 hover:text-blue-500" href="/">Home</a>
<span class="mx-2 text-gray-300">/</span>
<a class="text-blue-400 hover:text-blue-500" href="{% url 'account_login' %}">Log In</a>
<a class="text-blue-400 hover:text-blue-500" href="/">Home</a>
<span class="mx-2 text-gray-300">/</span>
<a class="text-blue-400 hover:text-blue-500"
href="{% url 'account_login' %}">Log In</a>
</div>
12 changes: 5 additions & 7 deletions allauth_ui/templates/account/_non_field_errors.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{% if form.non_field_errors %}
<ul class="max-w-xs">
{% for error in form.non_field_errors %}
<li class="my-6 text-xs font-medium tracking-wide text-red-500">
{{ error }}
</li>
{% endfor %}
</ul>
<ul class="max-w-xs">
{% for error in form.non_field_errors %}
<li class="my-6 text-xs font-medium tracking-wide text-red-500">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
32 changes: 14 additions & 18 deletions allauth_ui/templates/account/_render_form.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
{% load widget_tweaks %}

{% csrf_token %}

{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/>
<input type="hidden"
name="{{ redirect_field_name }}"
value="{{ redirect_field_value }}" />
{% endif %}

{% include "account/_non_field_errors.html" %}

{% for field in form.visible_fields %}
<div class="mb-4">
{{ field|add_label_class:"font-semibold text-xs" }}
{% if field.errors %}
{% render_field field class="flex items-center w-64 h-12 px-4 pb-2 mt-2 border-red-500 rounded focus:outline-none focus:ring-2" %}
{% else %}
{% render_field field class="flex items-center w-64 h-12 px-4 pb-2 mt-2 rounded focus:outline-none focus:ring-2" %}
{% endif %}
{% for error in field.errors %}
<span class="flex items-center max-w-xs mt-1 ml-1 text-xs font-medium tracking-wide text-red-500">
{{ error }}
</span>
{% endfor %}
</div>
<div class="mb-4">
{{ field|add_label_class:"font-semibold text-xs" }}
{% if field.errors %}
{% render_field field class="flex items-center w-64 h-12 px-4 pb-2 mt-2 border-red-500 rounded focus:outline-none focus:ring-2" %}
{% else %}
{% render_field field class="flex items-center w-64 h-12 px-4 pb-2 mt-2 rounded focus:outline-none focus:ring-2" %}
{% endif %}
{% for error in field.errors %}
<span class="flex items-center max-w-xs mt-1 ml-1 text-xs font-medium tracking-wide text-red-500">{{ error }}</span>
{% endfor %}
</div>
{% endfor %}
55 changes: 28 additions & 27 deletions allauth_ui/templates/account/base.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
{% load static %}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block head_title %}{% endblock %}</title>
<link rel="stylesheet" href="{% static 'allauth_ui/output.css' %}">
{% block extra_head %}
{% endblock %}
</head>
<body>
{% if messages %}
<div>
{% for message in messages %}
<div class="flex items-center px-4 py-3 text-sm font-bold text-white bg-blue-500" role="alert">
<p>{{ message }}</p>
</div>
{% endfor %}
</div>
{% endif %}
{% block content %}
<div class="flex flex-col items-center justify-center w-screen h-screen text-gray-700 bg-gray-200">
<div class="flex flex-col items-center p-12 bg-white rounded shadow-lg grow-0">
{% block whitebox %}
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
{% block head_title %}{% endblock %}
</title>
<link rel="stylesheet" href="{% static 'allauth_ui/output.css' %}">
{% block extra_head %}{% endblock %}
</head>
<body>
{% if messages %}
<div>
{% for message in messages %}
<div class="flex items-center px-4 py-3 text-sm font-bold text-white bg-blue-500"
role="alert">
<p>{{ message }}</p>
</div>
{% endfor %}
</div>
{% endif %}
{% block content %}
<div class="flex flex-col items-center justify-center w-screen h-screen text-gray-700 bg-gray-200">
<div class="flex flex-col items-center p-12 bg-white rounded shadow-lg grow-0">
{% block whitebox %}{% endblock %}
</div>
</div>
{% endblock %}
</div>
</div>
{% endblock %}
</body>
</body>
</html>
37 changes: 19 additions & 18 deletions allauth_ui/templates/account/email_confirm.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
{% extends "account/base.html" %}

{% load i18n %}
{% load account %}

{% block head_title %}{% trans "Confirm E-mail Address" %}{% endblock %}

{% block head_title %}
{% trans "Confirm E-mail Address" %}
{% endblock %}
{% block whitebox %}
<h1 class="mb-5 text-3xl text-center">{% trans "Confirm E-mail Address" %}</h1>
{% if confirmation %}
<p class="py-3">
{% blocktrans with confirmation.email_address.email as email %}
<h1 class="mb-5 text-3xl text-center">{% trans "Confirm E-mail Address" %}</h1>
{% if confirmation %}
<p class="py-3">
{% blocktrans with confirmation.email_address.email as email %}
Please confirm that <a href="mailto:{{ email }}">{{ email }}</a> is an e-mail address for user {{ user_display }}.
{% endblocktrans %}
</p>
<form method="POST" action="{% url 'account_confirm_email' confirmation.key %}" class="flex flex-col mt-4">
{% include "account/_render_form.html" %}
{% include "account/_button.html" with text="Confirm" %}
</form>
{% else %}
{% url 'account_email' as email_url %}
{% blocktrans %}
</p>
<form method="POST"
action="{% url 'account_confirm_email' confirmation.key %}"
class="flex flex-col mt-4">
{% include "account/_render_form.html" %}
{% include "account/_button.html" with text="Confirm" %}
</form>
{% else %}
{% url 'account_email' as email_url %}
{% blocktrans %}
This e-mail confirmation link expired or is invalid. Please <a href="{{ email_url }}">issue a new e-mail confirmation request.</a>
{% endblocktrans %}
{% endif %}
{% include "account/_links.html" %}
{% endif %}
{% include "account/_links.html" %}
{% endblock %}
87 changes: 40 additions & 47 deletions allauth_ui/templates/account/login.html
Original file line number Diff line number Diff line change
@@ -1,54 +1,47 @@
{% extends "account/base.html" %}
{% load i18n account allauth_ui widget_tweaks %}

{% block head_title %}
{% translate "Sign in" %}
{% translate "Sign in" %}
{% endblock %}

{% block whitebox %}
<h1 class="mb-5 text-3xl text-center">Sign in</h1>
<form method="POST" action="{% url 'account_login' %}" class="flex flex-col items-center grow-0">
{% csrf_token %}

{% include "account/_non_field_errors.html" %}

{% for field in form.visible_fields %}
{% if field.name != "remember" %}
<div class="mb-4">
{{ field|add_label_class:"font-semibold text-xs" }}
{% if field.errors %}
{% render_field field class="flex items-center w-64 h-12 px-4 pb-2 mt-2 border-red-500 rounded focus:outline-none focus:ring-2" %}
{% else %}
{% render_field field class="flex items-center w-64 h-12 px-4 pb-2 mt-2 rounded focus:outline-none focus:ring-2" %}
<h1 class="mb-5 text-3xl text-center">Sign in</h1>
<form method="POST"
action="{% url 'account_login' %}"
class="flex flex-col items-center grow-0">
{% csrf_token %}
{% include "account/_non_field_errors.html" %}
{% for field in form.visible_fields %}
{% if field.name != "remember" %}
<div class="mb-4">
{{ field|add_label_class:"font-semibold text-xs" }}
{% if field.errors %}
{% render_field field class="flex items-center w-64 h-12 px-4 pb-2 mt-2 border-red-500 rounded focus:outline-none focus:ring-2" %}
{% else %}
{% render_field field class="flex items-center w-64 h-12 px-4 pb-2 mt-2 rounded focus:outline-none focus:ring-2" %}
{% endif %}
{% for error in field.errors %}
<span class="flex items-center max-w-xs mt-1 ml-1 text-xs font-medium tracking-wide text-red-500">{{ error }}</span>
{% endfor %}
</div>
{% endif %}
{% endfor %}
{% translate "Login" as login_text %}
{% include "account/_button.html" with text=login_text %}
<div class="flex justify-center mt-6 text-xs">
<a class="text-blue-400 hover:text-blue-500"
href="{% url 'account_reset_password' %}">{% translate "Forgot Password" %}</a>
<span class="mx-2 text-gray-300">/</span>
<a class="text-blue-400 hover:text-blue-500"
href="{% url 'account_signup' %}">{% translate "Sign Up" %}</a>
</div>
{% if redirect_field_value %}
<input type="hidden"
name="{{ redirect_field_name }}"
value="{{ redirect_field_value }}" />
{% endif %}
</form>
{% check_allauth_socialaccount_installed as is_allauth_socialaccount_installed %}
{% if is_allauth_socialaccount_installed %}
{% include "socialaccount/snippets/social_login.html" %}
{% endif %}
{% for error in field.errors %}
<span class="flex items-center max-w-xs mt-1 ml-1 text-xs font-medium tracking-wide text-red-500">
{{ error }}
</span>
{% endfor %}
</div>
{% endif %}
{% endfor %}

{% translate "Login" as login_text %}
{% include "account/_button.html" with text=login_text %}

<div class="flex justify-center mt-6 text-xs">
<a class="text-blue-400 hover:text-blue-500" href="{% url 'account_reset_password' %}">{% translate "Forgot Password" %}
</a>
<span class="mx-2 text-gray-300">/</span>
<a class="text-blue-400 hover:text-blue-500" href="{% url 'account_signup' %}">{% translate "Sign Up" %}</a>
</div>

{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
</form>


{% check_allauth_socialaccount_installed as is_allauth_socialaccount_installed %}
{% if is_allauth_socialaccount_installed %}
{% include "socialaccount/snippets/social_login.html" %}
{% endif %}

{% endblock %}
19 changes: 10 additions & 9 deletions allauth_ui/templates/account/logout.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{% extends "account/base.html" %}

{% block head_title %}{% translate "Sign out" %}{% endblock %}

{% load i18n %}
{% block head_title %}
{% translate "Sign out" %}
{% endblock %}
{% block whitebox %}
<form method="post" action="{% url 'account_logout' %}">
{% csrf_token %}
<p>{% translate "Are you sure you want to sign out? %}</p>
{% translate "Sign out" as signout_message }
{% include "account/_button.html" with text=signout_message %}
</form>
<form method="post" action="{% url 'account_logout' %}">
{% csrf_token %}
<p>{% translate "Are you sure you want to sign out?" %}</p>
{% translate "Sign out" as signout_message }
{% include "account/_button.html" with text=signout_message %}
</form>
{% endblock %}
29 changes: 16 additions & 13 deletions allauth_ui/templates/account/password_reset.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
{% extends "account/base.html" %}

{% block head_title %}{% translate "Password Reset" %}{% endblock %}

{% load i18n %}
{% block head_title %}
{% translate "Password Reset" %}
{% endblock %}
{% block whitebox %}
<h1 class="mb-5 text-3xl text-center">{% translate "Password Reset" %}</h1>
<p class="mb-5 text-sm text-center">
{% translate "Enter your user account's verified email address and we will send you a password reset link." %}
</p>
<form method="POST" action="{% url 'account_reset_password' %}" class="flex flex-col mt-4">
{% include "account/_render_form.html" %}
{% translate "Reset my password" as reset_text %}
{% include "account/_button.html" with text=reset_text %}
</form>
{% include "account/_links.html" %}
<h1 class="mb-5 text-3xl text-center">{% translate "Password Reset" %}</h1>
<p class="mb-5 text-sm text-center">
{% translate "Enter your user account's verified email address and we will send you a password reset link." %}
</p>
<form method="POST"
action="{% url 'account_reset_password' %}"
class="flex flex-col mt-4">
{% include "account/_render_form.html" %}
{% translate "Reset my password" as reset_text %}
{% include "account/_button.html" with text=reset_text %}
</form>
{% include "account/_links.html" %}
{% endblock %}
Loading

0 comments on commit e9b5f8f

Please sign in to comment.