@@ -0,0 +1,104 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="/public/bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- Website CSS -->
|
||||
<link rel="stylesheet" type="text/css" href="/public/style.css">
|
||||
|
||||
<title>{% block title %}Lab 03 - Advanced Web{% endblock %}</title>
|
||||
</head>
|
||||
<body>
|
||||
<header class="site-header">
|
||||
<div class="container">
|
||||
<div id="header-image"></div>
|
||||
</div>
|
||||
<!-- This is the menu -->
|
||||
<nav class="navbar navbar-expand-md navbar-dark">
|
||||
<div class="container">
|
||||
<a class="navbar-brand mr-4" href="/">Menu</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggle" aria-controls="navbarToggle" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarToggle">
|
||||
<div class="navbar-nav mr-auto">
|
||||
<a class="nav-item nav-link" href="/">Home</a>
|
||||
<a class="nav-item nav-link" href="/second">Second</a>
|
||||
{% if session.get('authenticated') %}
|
||||
<a class="nav-item nav-link" href="/account-details">Account Details</a>
|
||||
{% else %}
|
||||
<a class="nav-item nav-link" href="#">About</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<!-- Navbar Right Side -->
|
||||
<div class="navbar-nav">
|
||||
{% if session.get('authenticated') %}
|
||||
<a class="nav-item nav-link" href="/logout">Logout</a>
|
||||
{% else %}
|
||||
<a class="nav-item nav-link" href="/login">Login</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<!-- Main container follows (with main content + right sidebar) -->
|
||||
<main role="main" class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<!-- Left-side content -->
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<!-- Right side bar -->
|
||||
<div class="content-box" id="account">
|
||||
<h4>Your Account</h4>
|
||||
{% if session.get('authenticated') %}
|
||||
<p class="logged-in">Authenticated as: <strong>{{ session.get('username') }}</strong></p>
|
||||
<p>
|
||||
<a href="/account-details" class="btn btn-sm btn-outline-primary">Account Details</a>
|
||||
<a href="/logout" class="btn btn-sm btn-outline-danger">Logout</a>
|
||||
</p>
|
||||
{% else %}
|
||||
<p class="logged-out">Not authenticated!</p>
|
||||
<p>Click <a href="/login">here to login</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="content-box">
|
||||
<h4>Changelog</h4>
|
||||
<p>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item list-group-item-light">
|
||||
<div class="d-flex w-100 justify-content-between">
|
||||
<div class="news-item mb-1">We just added authentication!</div>
|
||||
<small class="text-muted">📅 2024-03-31</small>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item list-group-item-light">
|
||||
<div class="d-flex w-100 justify-content-between">
|
||||
<div class="news-item mb-1">💗 Migrate to Flask server</div>
|
||||
<small class="text-muted">📅 2024-03-30</small>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item list-group-item-light">
|
||||
<div class="d-flex w-100 justify-content-between">
|
||||
<div class="news-item mb-1">First version of the website</div>
|
||||
<small class="text-muted">📅 2024-03-27</small>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- Include Bootstrap script -->
|
||||
<script src="/public/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,32 @@
|
||||
{% extends "_base.html" %}
|
||||
|
||||
{% block title %}Account Details - Lab 03{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="content-box main-content">
|
||||
<h1 class="main-title">Account Details</h1>
|
||||
|
||||
<p>For a complete experience on this website, please enter your personal details in the form below:</p>
|
||||
|
||||
<form method="post" class="account-form" enctype="multipart/form-data">
|
||||
<div class="mb-3 text-center">
|
||||
<img src="/public/images/profile/profile.jpg" alt="Profile Picture" class="img-thumbnail" style="max-width: 200px; display: block; margin: 0 auto 15px;" onerror="this.src='/public/images/maestrul.jpg';">
|
||||
<label for="profile_pic" class="form-label">Update Profile Picture</label>
|
||||
<input type="file" class="form-control" id="profile_pic" name="profile_pic">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="first_name" class="form-label">First Name</label>
|
||||
<input type="text" class="form-control" id="first_name" name="first_name" value="{{ first_name }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="last_name" class="form-label">Last Name</label>
|
||||
<input type="text" class="form-control" id="last_name" name="last_name" value="{{ last_name }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="age" class="form-label">Age</label>
|
||||
<input type="text" class="form-control" id="age" name="age" value="{{ age }}">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Save Details</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,32 @@
|
||||
{% extends "_base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="content-box main-content">
|
||||
<h1 class="main-title">Homepage</h1>
|
||||
<p>
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
||||
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
|
||||
enim ad minim veniam, quis nostrud exercitation ullamco laboris
|
||||
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
|
||||
reprehenderit in voluptate velit esse cillum dolore eu fugiat
|
||||
nulla pariatur. Excepteur sint occaecat cupidatat non proident,
|
||||
sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
</p>
|
||||
<p>
|
||||
At vero eos et accusamus et iusto odio dignissimos ducimus qui
|
||||
blanditiis praesentium voluptatum deleniti atque corrupti quos
|
||||
dolores et quas molestias excepturi sint occaecati cupiditate
|
||||
non provident, similique sunt in culpa qui officia deserunt
|
||||
mollitia animi, id est laborum et dolorum fuga. Et harum quidem
|
||||
rerum facilis est et expedita distinctio. Nam libero tempore,
|
||||
cum soluta nobis est eligendi optio cumque nihil impedit quo
|
||||
minus id quod maxime placeat facere possimus, omnis voluptas
|
||||
assumenda est, omnis dolor repellendus. Temporibus autem
|
||||
quibusdam et aut officiis debitis aut rerum necessitatibus
|
||||
saepe eveniet ut et voluptates repudiandae sint et molestiae
|
||||
non recusandae. Itaque earum rerum hic tenetur a sapiente
|
||||
delectus, ut aut reiciendis voluptatibus maiores alias
|
||||
consequatur aut perferendis doloribus asperiores repellat.
|
||||
</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,24 @@
|
||||
{% extends "_base.html" %}
|
||||
|
||||
{% block title %}Login - Lab 03{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="content-box main-content">
|
||||
<h1 class="main-title">Login</h1>
|
||||
|
||||
<form method="post" class="login-form">
|
||||
{% if error_msg %}
|
||||
<div style="color: red;">{{ error_msg }}</div>
|
||||
{% endif %}
|
||||
<div class="mb-3">
|
||||
<label for="username" class="form-label">Username</label>
|
||||
<input type="text" class="form-control" name="username" id="username">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Password</label>
|
||||
<input type="password" class="form-control" name="password" id="password">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,17 @@
|
||||
{% extends "_base.html" %}
|
||||
|
||||
{% block title %}Second Page - Lab 03{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="content-box main-content">
|
||||
<h1 class="main-title">Second Page</h1>
|
||||
<p>
|
||||
This is the second page of our Flask application.
|
||||
</p>
|
||||
<p>
|
||||
Here you can see how Jinja2 template inheritance allows us to reuse the same layout across multiple pages.
|
||||
The navbar, header, and sidebar are all defined in <code>_base.html</code>, while this content is unique to <code>second.html</code>.
|
||||
</p>
|
||||
<img src="/public/images/cats.jpeg" alt="Cats" class="img-fluid">
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user