Skip to content

Commit

Permalink
Homepage Had Blogs!
Browse files Browse the repository at this point in the history
  • Loading branch information
symkat committed Nov 24, 2021
1 parent 7b9f48f commit e785e28
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Web/lib/BlogDB/Web/Controller/Root.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use Data::UUID;
sub get_homepage ($c) {
$c->set_template( 'index' );

push @{$c->stash->{blogs}}, $c->db->resultset('Blog')->all;

}

sub get_register ($c) {
Expand Down
20 changes: 20 additions & 0 deletions Web/templates/default/index.html.tx
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,24 @@
</form>
</div>

<div class="row row-cols-3 row-cols-md-3 g-4">
%% for $blogs -> $blog {
<div class="col">
<div class="card" style="width: 24rem;">
<img src="[% $blog.img_url %]" class="card-img-top" alt="Screenshot">
<div class="card-body">
<h5 class="card-title">[% $blog.title %]</h5>
<p class="card-text">
[% $blog.tagline %] <br />
About: [% $blog.about %]<br/>
</p>
</div>
<div class="card-footer">
<a href="[% $c.url_for( 'view_blog', slug => $blog.slug ) %]" class="btn btn-primary">View Blog</a>
</div>
</div>
</div>
%% }
</div>

%% }

0 comments on commit e785e28

Please sign in to comment.