Implement post count
This commit is contained in:
parent
575431237b
commit
53f292ac7c
|
@ -55,4 +55,4 @@ Add the `-v` option for more verbose output
|
||||||
## TODOs
|
## TODOs
|
||||||
|
|
||||||
1. /spam route would be interesting
|
1. /spam route would be interesting
|
||||||
1. Include the total number of visitors or messages
|
1. Visitor counter
|
||||||
|
|
1
cpanfile
1
cpanfile
|
@ -7,3 +7,4 @@ requires 'Mojolicious::Plugin::TagHelpers::Pagination';
|
||||||
requires 'Mojolicious::Plugin::AssetPack';
|
requires 'Mojolicious::Plugin::AssetPack';
|
||||||
requires 'Regexp::Common::URI';
|
requires 'Regexp::Common::URI';
|
||||||
requires 'CSS::Minifier::XS';
|
requires 'CSS::Minifier::XS';
|
||||||
|
requires 'Number::Format';
|
||||||
|
|
|
@ -7,6 +7,7 @@ use Mojolicious::Lite -signatures;
|
||||||
use Mojo::Pg;
|
use Mojo::Pg;
|
||||||
use List::Util qw{shuffle};
|
use List::Util qw{shuffle};
|
||||||
use Regexp::Common qw{URI};
|
use Regexp::Common qw{URI};
|
||||||
|
use Number::Format qw{format_number};
|
||||||
#use Data::Dumper; # Uncomment for debugging
|
#use Data::Dumper; # Uncomment for debugging
|
||||||
|
|
||||||
# Load the model
|
# Load the model
|
||||||
|
@ -45,11 +46,13 @@ get '/' => sub ($c) {
|
||||||
my $this_page = $c->param('page') || 1;
|
my $this_page = $c->param('page') || 1;
|
||||||
my $last_page = $c->message->get_last_page();
|
my $last_page = $c->message->get_last_page();
|
||||||
my $view_posts = $c->message->get_posts($this_page);
|
my $view_posts = $c->message->get_posts($this_page);
|
||||||
|
my $post_count = format_number $c->message->get_post_count();
|
||||||
|
|
||||||
$c->stash(
|
$c->stash(
|
||||||
view_posts => $view_posts,
|
view_posts => $view_posts,
|
||||||
this_page => $this_page,
|
this_page => $this_page,
|
||||||
last_page => $last_page
|
last_page => $last_page,
|
||||||
|
post_count => $post_count
|
||||||
);
|
);
|
||||||
|
|
||||||
$c->render();
|
$c->render();
|
||||||
|
|
|
@ -28,8 +28,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="outer">
|
<div class="outer">
|
||||||
<footer>
|
<footer>
|
||||||
<p>Maximize your dynamic innovation using battle-tested deep
|
<p><%= $post_count %> visitors have signed the guestbook to date.</p>
|
||||||
learning models.</p>
|
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue