Skip to content

Commit

Permalink
Better template structure
Browse files Browse the repository at this point in the history
  • Loading branch information
trygvis committed Jan 3, 2025
1 parent 1a34f83 commit 7c0dd3e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 33 deletions.
14 changes: 14 additions & 0 deletions backend/templates/_base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="icon" href="data:;base64,," />
<link rel="stylesheet" href="/assets/reset-zone.regular.css">
<title>{% block title -%}{{ title }}{%- endblock %} - Skjera</title>
{% block head %}{% endblock %}
</head>
<body>
<div id="content">
{% block content %}<p>Placeholder content</p>{% endblock %}
</div>
</body>
</html>
16 changes: 6 additions & 10 deletions backend/templates/employee.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<link rel="icon" href="data:;base64,," />
<link rel="stylesheet" href="/assets/reset-zone.regular.css">
<title>Skjera - {{ employee.name }}</title>
</head>
<body>
{% extends "_base.html" %}

{% block title %}{{ employee.name }}{% endblock %}

{% block content %}
<h1>Skjera - {{ employee.name }}</h1>
Date of birth: {{ Self::dob(self) }}
</body>
</html>
{% endblock %}
15 changes: 6 additions & 9 deletions backend/templates/hello.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<link rel="icon" href="data:;base64,," />
<link rel="stylesheet" href="/assets/reset-zone.regular.css">
</head>
<body>
{% extends "_base.html" %}

{% block title %}Skjera?!{% endblock %}

{% block content %}
{% if let Some(user) = user %}
<p>
Hello {{ user.name }}!
Expand Down Expand Up @@ -39,5 +37,4 @@ <h2>Employees</h2>
{% endfor %}
</table>
{% endif %}
</body>
</html>
{% endblock %}
27 changes: 13 additions & 14 deletions backend/templates/me.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<link rel="icon" href="data:;base64,," />
<link rel="stylesheet" href="/assets/reset-zone.regular.css">
<style>
tr th {
vertical-align: top;
}
</style>
</head>
<body>
{% extends "_base.html" %}

{% block title %}Edit Profile{% endblock %}
{% block head %}
<style>
tr th {
vertical-align: top;
}
</style>
{% endblock %}

{% block content %}
<h1>Edit profile</h1>
<form action="/me" method="POST">
<table>
Expand Down Expand Up @@ -125,5 +125,4 @@ <h3>Add SoMe Account</h3>
</table>
</form>

</body>
</html>
{% endblock %}

0 comments on commit 7c0dd3e

Please sign in to comment.