Skip to content

Commit

Permalink
(feat): Dynamic templates for all objects
Browse files Browse the repository at this point in the history
  • Loading branch information
LopesLs committed Dec 24, 2023
1 parent abfac24 commit 9dd8677
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 49 deletions.
17 changes: 17 additions & 0 deletions scheduleManagement/templates/confirm-delete.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ object_type | capfirst }} | Delete</title>
</head>
<body>
<h1>{{ object_type | capfirst }} | Delete</h1>

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

<form method="post">
{% csrf_token %}
<input type="submit" value="Yes, I'm sure">
</body>
</html>
16 changes: 0 additions & 16 deletions scheduleManagement/templates/course.html

This file was deleted.

18 changes: 0 additions & 18 deletions scheduleManagement/templates/details.html

This file was deleted.

22 changes: 22 additions & 0 deletions scheduleManagement/templates/form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ object_type | capfirst }} | Update</title>
</head>
<body>
{% if object_type %}
<h1>{{ object_type | capfirst }} | Update</h1>
{% else %}
<h1>Create</h1>
{% endif %}

<form method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Save">
</form>
<a href="{{request.META.HTTP_REFERER}}">Back</a>
</body>
</html>
13 changes: 13 additions & 0 deletions scheduleManagement/templates/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home page</title>
</head>
<body>
<a href="list-courses"><p>Courses</p></a>
<a href="list-disciplines"><p>Disciplines</p></a>
<a href="list-schedules"><p>Schedules</p></a>
</body>
</html>
15 changes: 0 additions & 15 deletions scheduleManagement/templates/index.html

This file was deleted.

16 changes: 16 additions & 0 deletions scheduleManagement/templates/list-object.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ object_type | capfirst }} | List</title>
</head>
<body>
<h1>{{ object_type | capfirst }} | List</h1>
{% for object in objects %}
<a href="{{ object.id }}"><p>{{ object }}</p></a>
{% endfor %}
<button onclick="location.href = 'create'">Adicionar {{ object_type }}</button>
<a href="/">Back</a>
</body>
</html>
20 changes: 20 additions & 0 deletions scheduleManagement/templates/object-details.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ object_type | capfirst }} | Details</title>
</head>
<body>
<h1> {{ object_type | capfirst }} | Details</h1>
{% for field, value in object.items %}
<ul>
<li>{{ field }}: {{ value }}</li>
</ul>
{% endfor %}

<button onclick="location.href = 'edit/{{ object.id }}'" >Update</button>
<button onclick="location.href = 'delete/{{ object.id }}'" >Delete</button>
<a href="/list-{{ object_type }}s">Back</a>
</body>
</html>

0 comments on commit 9dd8677

Please sign in to comment.