Skip to content

Commit e0cdea8

Browse files
author
Kaitlyn Parkhurst
committed
Breakdown the template.
1 parent 32cb62a commit e0cdea8

File tree

2 files changed

+88
-82
lines changed

2 files changed

+88
-82
lines changed

Web/templates/default/_/layout.tx

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
%% my $gear_icon = mark_raw('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-gear" viewBox="0 0 16 16"> <path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492zM5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0z"/> <path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52l-.094-.319zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.377l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115l.094-.319z"/> </svg>');
2+
3+
%% my $door_icon = mark_raw('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-door-closed-fill" viewBox="0 0 16 16"><path d="M12 1a1 1 0 0 1 1 1v13h1.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1H3V2a1 1 0 0 1 1-1h8zm-2 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/></svg>');
4+
5+
<!doctype html>
6+
<html lang="en">
7+
<head>
8+
<!-- Required meta tags -->
9+
<meta charset="utf-8">
10+
<meta name="viewport" content="width=device-width, initial-scale=1">
11+
12+
<!-- Bootstrap CSS -->
13+
<link
14+
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/css/bootstrap.min.css"
15+
rel="stylesheet"
16+
integrity="sha384-uWxY/CJNBR+1zjPWmfnSnVxwRheevXITnMqoEIeG1LJrdI0GlVs/9cVSyPYXdcSF"
17+
crossorigin="anonymous">
18+
19+
<style>
20+
21+
.main {
22+
background-color: orange;
23+
height: 100%;
24+
}
25+
</style>
26+
27+
<title>[% $title ? "BlogDB - " ~ $title : "BlogDB" %]</title>
28+
</head>
29+
<body>
30+
<nav class="navbar navbar-light bg-light">
31+
<div class="container-fluid">
32+
<div class="col">
33+
<a class="navbar-brand" style="font-size: 3em;" href="#">BlogDB</a>
34+
</div>
35+
<div class="col">
36+
%% if ( $login_fail ) {
37+
<p class="warning">Error: Login Failed.</p>
38+
%% }
39+
</div>
40+
%% if ( $person ) {
41+
<div class="col">
42+
<a href="[% $c.url_for( 'user', { name => $person.username } ) %]">[% $person.username %]</a>
43+
<a href="[% $c.url_for( 'user_settings' ) %]">[% $gear_icon %]</a>
44+
45+
<form method="post" action="[% $c.url_for( 'do_logout' ) %]">
46+
<button class="link" type="submit">[% $door_icon %]</button>
47+
</form>
48+
</div>
49+
50+
%% } else {
51+
<div class="col">
52+
<form method="post" action="[% $c.url_for( 'do_login' ) %]" class="d-flex">
53+
<input type="hidden" name="return_url" value="[% $form_return || $c.url_for() %]">
54+
<input class="form-control me-2" type="text" name="username" placeholder="Username" aria-label="Username">
55+
<input class="form-control me-2" type="password" name="password" placeholder="Password" aria-label="Password">
56+
<button class="btn btn-outline-success" type="submit">Login</button>
57+
</form>
58+
<div class="container-fluid">
59+
<p style="margin-right: 0em;"><a href="[% $c.url_for('register') %]">Register</a> | <a href="[% $c.url_for( 'forgot' ) %]">Forgot</a></p>
60+
</div>
61+
</div>
62+
%% }
63+
</div>
64+
</nav>
65+
66+
<main class="content-fluid main">
67+
68+
%% block panel -> {}
69+
70+
</main>
71+
72+
73+
74+
75+
76+
<!-- Bootstrap Javascript -->
77+
<script
78+
src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/js/bootstrap.bundle.min.js"
79+
integrity="sha384-kQtW33rZJAHjgefvhyyzcGF3C5TFyBQBA13V1RKPf4uH+bwyzQxZ6CmMZHmNBEfJ"
80+
crossorigin="anonymous">
81+
</script>
82+
</body>
83+
</html>
Lines changed: 5 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,8 @@
1-
%% my $gear_icon = mark_raw('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-gear" viewBox="0 0 16 16"> <path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492zM5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0z"/> <path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52l-.094-.319zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.377l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115l.094-.319z"/> </svg>');
2-
3-
%% my $door_icon = mark_raw('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-door-closed-fill" viewBox="0 0 16 16"><path d="M12 1a1 1 0 0 1 1 1v13h1.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1H3V2a1 1 0 0 1 1-1h8zm-2 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"/></svg>');
4-
5-
<!doctype html>
6-
<html lang="en">
7-
<head>
8-
<!-- Required meta tags -->
9-
<meta charset="utf-8">
10-
<meta name="viewport" content="width=device-width, initial-scale=1">
11-
12-
<!-- Bootstrap CSS -->
13-
<link
14-
href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/css/bootstrap.min.css"
15-
rel="stylesheet"
16-
integrity="sha384-uWxY/CJNBR+1zjPWmfnSnVxwRheevXITnMqoEIeG1LJrdI0GlVs/9cVSyPYXdcSF"
17-
crossorigin="anonymous">
18-
19-
<style>
20-
21-
.main {
22-
background-color: orange;
23-
height: 100%;
24-
}
25-
</style>
26-
27-
<title>Hello, world!</title>
28-
</head>
29-
<body>
30-
<nav class="navbar navbar-light bg-light">
31-
<div class="container-fluid">
32-
<div class="col">
33-
<a class="navbar-brand" style="font-size: 3em;" href="#">BlogDB</a>
34-
</div>
35-
<div class="col">
36-
%% if ( $login_fail ) {
37-
<p class="warning">Error: Login Failed.</p>
38-
%% }
39-
</div>
40-
%% if ( $person ) {
41-
<div class="col">
42-
<a href="[% $c.url_for( 'user', { name => $person.username } ) %]">[% $person.username %]</a>
43-
<a href="[% $c.url_for( 'user_settings' ) %]">[% $gear_icon %]</a>
44-
45-
<form method="post" action="[% $c.url_for( 'do_logout' ) %]">
46-
<button class="link" type="submit">[% $door_icon %]</button>
47-
</form>
48-
</div>
49-
50-
%% } else {
51-
<div class="col">
52-
<form method="post" action="[% $c.url_for( 'do_login' ) %]" class="d-flex">
53-
<input type="hidden" name="return_url" value="[% $form_return || $c.url_for() %]">
54-
<input class="form-control me-2" type="text" name="username" placeholder="Username" aria-label="Username">
55-
<input class="form-control me-2" type="password" name="password" placeholder="Password" aria-label="Password">
56-
<button class="btn btn-outline-success" type="submit">Login</button>
57-
</form>
58-
<div class="container-fluid">
59-
<p style="margin-right: 0em;"><a href="[% $c.url_for('register') %]">Register</a> | <a href="[% $c.url_for( 'forgot' ) %]">Forgot</a></p>
60-
</div>
61-
</div>
62-
%% }
63-
</div>
64-
</nav>
65-
66-
<main class="content-fluid main">
1+
%% cascade default::_::layout { title => 'Register',
2+
%%
3+
%% }
674

5+
%% override panel -> {
686
<div class="row">
697
<!-- Error Handling On LHS -->
708
<div class="col">
@@ -111,19 +49,4 @@
11149

11250
</form>
11351
</div>
114-
115-
116-
</main>
117-
118-
119-
120-
121-
122-
<!-- Bootstrap Javascript -->
123-
<script
124-
src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.2/dist/js/bootstrap.bundle.min.js"
125-
integrity="sha384-kQtW33rZJAHjgefvhyyzcGF3C5TFyBQBA13V1RKPf4uH+bwyzQxZ6CmMZHmNBEfJ"
126-
crossorigin="anonymous">
127-
</script>
128-
</body>
129-
</html>
52+
%% }

0 commit comments

Comments
 (0)