Skip to content

Commit

Permalink
Merge pull request #15 from Django-Projects-Ls/refactor/better-templates
Browse files Browse the repository at this point in the history
Refactor/better templates
  • Loading branch information
LopesLs authored Jan 3, 2024
2 parents 4743aca + 9cc31bb commit ea4c1b6
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 52 deletions.
30 changes: 12 additions & 18 deletions scheduleManagement/templates/account/login.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
{% load socialaccount %}

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sign In</title>
{% block title %} <title>Sign In</title> {% endblock %}
</head>
<body>
<title>Sign In</title>

<h1>Sign in</h1>

<p>Still don't have an account, then please <a href="{{ signup_url }}">sign up</a></p>

{% url 'account_login' as login_url %}

<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Login</button>
</form>

{% load socialaccount %}

<a href="{% provider_login_url 'google'%}">Login with google</a>
{% block content %}
<h1>Sign in</h1>

<p>Still don't have an account, then please <a href="{{ signup_url }}">sign up</a></p>

{% include "partials/form_component.html" with value="Login" %}

<a href="{% provider_login_url 'google'%}">Login with google</a>
{% endblock %}
</body>
</html>
23 changes: 8 additions & 15 deletions scheduleManagement/templates/account/logout.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Logout</title>
</head>
<body>
{% extends 'account/login.html' %}

{% block title %} <title>Logout</title> {% endblock %}

{% block content %}
<h1>Logout</h1>
<p>Are you sure that you want to logout of <strong>{{ user.username }}</strong></p>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button>Continue</button>
</form>
</body>
</html>

{% include "partials/form_component.html" with value="Continue" %}
{% endblock %}
2 changes: 1 addition & 1 deletion scheduleManagement/templates/confirm-delete.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ <h1>{{ object_type | capfirst }} | Delete</h1>

<p>Are you sure you want to delete <strong>{{ object }}?</strong></p>

{% include 'partials/form_component.html' with value="Yes, i'm sure" delete=true %}
{% include "partials/form_component.html" with value="Yes, i'm sure" delete=true %}
{% endblock %}
25 changes: 9 additions & 16 deletions scheduleManagement/templates/socialaccount/login.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sign in via google</title>
</head>
<body>
{% extends 'account/login.html' %}

{% block title %} <title>Sign in via google</title> {% endblock %}

{% block content %}
<h1>Sign via google</h1>
<p>You area about to sign with a third-party environment</p>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button>Continue</button>
</form>
</body>
</html>
<p>You are about to sign with a third-party environment</p>

{% include "partials/form_component.html" with value="Continue" %}
{% endblock %}
2 changes: 0 additions & 2 deletions schoolschedules/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
https://docs.djangoproject.com/en/4.2/ref/settings/
"""

from django.urls import reverse_lazy
from dotenv import load_dotenv
from pathlib import Path

Expand Down Expand Up @@ -164,4 +163,3 @@

LOGIN_REDIRECT_URL = "/" # redirect to home page after login
LOGOUT_REDIRECT_URL = "/" # redirect to login page after logout

0 comments on commit ea4c1b6

Please sign in to comment.