Skip to content

Commit fdb76cf

Browse files
committed
Try at a new template
1 parent fb35c3e commit fdb76cf

File tree

9 files changed

+11540
-1
lines changed

9 files changed

+11540
-1
lines changed

Web/lib/BlogDB/Web.pm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ sub startup ($self) {
3232
$c->stash->{template} = sprintf( "%s/%s", $c->config->{template_dir}, $name );
3333
});
3434

35+
# Make _public/ in the template dir be on the static path resolution.
36+
push @{$self->static->paths}, 'templates/' . $self->config->{template_dir} . "/_public";
37+
3538
$self->plugin( 'BlogDB::Web::Plugin::MinionTasks');
3639

40+
# Add the templates/$name/_public/ directory to the static paths,
41+
# if the directory exists.
42+
3743
# Get the router.
3844
my $router = $self->routes;
3945

Web/lib/BlogDB/Web/Controller/Blog.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ sub _slug_to_id ($self, $slug) {
1717
}
1818

1919
sub get_view_blog ($c) {
20-
$c->set_template( 'blog/index' );
20+
$c->set_template( 'blog/item' );
2121

2222
my $blog = $c->stash->{blog} = $c->db->resultset('Blog')->find(
2323
$c->_slug_to_id($c->param('slug'))

Web/lib/BlogDB/Web/Controller/Root.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ sub get_homepage ($c) {
77
$c->set_template( 'index' );
88

99
push @{$c->stash->{blogs}}, $c->db->resultset('Blog')->all;
10+
push @{$c->stash->{tags_a}}, grep { $_->id % 2 == 1 } $c->db->resultset('Tag')->all;
11+
push @{$c->stash->{tags_b}}, grep { $_->id % 2 == 0 } $c->db->resultset('Tag')->all;
1012

1113
}
1214

File renamed without changes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- _/_blog_card.tx start -->
2+
<div class="card mb-4">
3+
<a href="[% $c.url_for( 'view_blog', 'slug' => $blog.slug ) %]"><img class="card-img-top" src="[% $blog.img_url %]" alt="..." /></a>
4+
<div class="card-body">
5+
<div class="small text-muted">Last Updated: January 1, 2021</div>
6+
<h2 class="card-title h4">[% $blog.title %]</h2>
7+
<p class="card-text">[% $blog.tagline %]</p>
8+
<a class="btn btn-primary" href="[% $c.url_for( 'view_blog', 'slug',$blog.slug ) %]">View Entry →</a>
9+
</div>
10+
</div>
11+
<!-- _/_blog_card.tx end -->

Web/templates/simple/_/layout.tx

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
6+
<meta name="description" content="" />
7+
<meta name="author" content="" />
8+
<title>[% $title ? "BlogDB - " ~ $title : "BlogDB" %]</title>
9+
<!-- Favicon-->
10+
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
11+
<!-- Core theme CSS (includes Bootstrap)-->
12+
<link href="/css/styles.css" rel="stylesheet" />
13+
</head>
14+
<body>
15+
<!-- Responsive navbar-->
16+
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
17+
<div class="container">
18+
<a class="navbar-brand" href="[% $c.url_for( 'homepage' ) %]">BlogDB</a>
19+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
20+
<div class="collapse navbar-collapse" id="navbarSupportedContent">
21+
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
22+
<li class="nav-item"><a class="nav-link" href="#">Home</a></li>
23+
<li class="nav-item"><a class="nav-link" href="#!">About</a></li>
24+
<li class="nav-item"><a class="nav-link" href="#!">Contact</a></li>
25+
<li class="nav-item"><a class="nav-link active" aria-current="page" href="#">Blog</a></li>
26+
</ul>
27+
</div>
28+
</div>
29+
</nav>
30+
31+
%% if ( $hide_welcome_screen ) {
32+
<!-- Minimal Page header for padding-->
33+
<header class="py-5 bg-light border-bottom mb-4"></header>
34+
%% } else {
35+
<!-- Page header with logo and tagline-->
36+
<header class="py-5 bg-light border-bottom mb-4">
37+
<div class="container">
38+
<div class="text-center my-5">
39+
<h1 class="fw-bolder">Welcome to BlogDB!</h1>
40+
<p class="lead mb-0">We showcase a collection of blogs from around the internet.</p>
41+
</div>
42+
</div>
43+
</header>
44+
%% }
45+
46+
<!-- Page content-->
47+
<div class="container">
48+
<div class="row">
49+
<!-- Blog entries-->
50+
<div class="col-lg-8">
51+
52+
<!-- Panel Block Begin-->
53+
%% block panel -> {
54+
55+
%% }
56+
<!-- Panel Block End-->
57+
58+
<!-- Pagination-->
59+
<nav aria-label="Pagination">
60+
<hr class="my-0" />
61+
<ul class="pagination justify-content-center my-4">
62+
<li class="page-item disabled"><a class="page-link" href="#" tabindex="-1" aria-disabled="true">Newer</a></li>
63+
<li class="page-item active" aria-current="page"><a class="page-link" href="#!">1</a></li>
64+
<li class="page-item"><a class="page-link" href="#!">2</a></li>
65+
<li class="page-item"><a class="page-link" href="#!">3</a></li>
66+
<li class="page-item disabled"><a class="page-link" href="#!">...</a></li>
67+
<li class="page-item"><a class="page-link" href="#!">15</a></li>
68+
<li class="page-item"><a class="page-link" href="#!">Older</a></li>
69+
</ul>
70+
</nav>
71+
</div>
72+
<!-- Side widgets-->
73+
<div class="col-lg-4">
74+
75+
%% block blog_homepage_section -> {}
76+
77+
78+
<!-- Search widget-->
79+
<div class="card mb-4">
80+
<div class="card-header">Suggest a blog to be added</div>
81+
<div class="card-body">
82+
<form method="post" action="[% $c.url_for( 'do_new_blog' ) %]">
83+
<div class="input-group">
84+
<input class="form-control" type="text" placeholder="https://..." aria-label="Enter url" aria-describedby="button-add" />
85+
<button class="btn btn-primary" id="button-add" type="submit">Suggest Blog</button>
86+
</div>
87+
</form>
88+
</div>
89+
</div>
90+
<!-- Categories widget-->
91+
<div class="card mb-4">
92+
<div class="card-header">Tags</div>
93+
<div class="card-body">
94+
<div class="row">
95+
<div class="col-sm-6">
96+
<ul class="list-unstyled mb-0">
97+
%% for $tags_a -> $tag {
98+
<li><a href="#!">#[% $tag.name %]</a></li>
99+
%% }
100+
</ul>
101+
</div>
102+
<div class="col-sm-6">
103+
<ul class="list-unstyled mb-0">
104+
%% for $tags_a -> $tag {
105+
<li><a href="#!">#[% $tag.name %]</a></li>
106+
%% }
107+
</ul>
108+
</div>
109+
</div>
110+
</div>
111+
</div>
112+
<!-- Side widget-->
113+
<div class="card mb-4">
114+
<div class="card-header">Side Widget</div>
115+
<div class="card-body">You can put anything you want inside of these side widgets. They are easy to use, and feature the Bootstrap 5 card component!</div>
116+
</div>
117+
</div>
118+
</div>
119+
</div>
120+
<!-- Footer-->
121+
<footer class="py-5 bg-dark">
122+
<div class="container"><p class="m-0 text-center text-white">Copyright &copy; Your Website 2021</p></div>
123+
</footer>
124+
<!-- Bootstrap core JS-->
125+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
126+
<!-- Core theme JS-->
127+
<script src="js/scripts.js"></script>
128+
</body>
129+
</html>

0 commit comments

Comments
 (0)