diff --git a/README.md b/README.md index ca0f937..290c087 100644 --- a/README.md +++ b/README.md @@ -55,4 +55,4 @@ Add the `-v` option for more verbose output ## TODOs 1. /spam route would be interesting -1. Include the total number of visitors or messages +1. Visitor counter diff --git a/cpanfile b/cpanfile index 1c2e62b..eed466f 100644 --- a/cpanfile +++ b/cpanfile @@ -7,3 +7,4 @@ requires 'Mojolicious::Plugin::TagHelpers::Pagination'; requires 'Mojolicious::Plugin::AssetPack'; requires 'Regexp::Common::URI'; requires 'CSS::Minifier::XS'; +requires 'Number::Format'; diff --git a/guestbook-ng.pl b/guestbook-ng.pl index c1418ab..a70a387 100755 --- a/guestbook-ng.pl +++ b/guestbook-ng.pl @@ -7,6 +7,7 @@ use Mojolicious::Lite -signatures; use Mojo::Pg; use List::Util qw{shuffle}; use Regexp::Common qw{URI}; +use Number::Format qw{format_number}; #use Data::Dumper; # Uncomment for debugging # Load the model @@ -45,11 +46,13 @@ get '/' => sub ($c) { my $this_page = $c->param('page') || 1; my $last_page = $c->message->get_last_page(); my $view_posts = $c->message->get_posts($this_page); + my $post_count = format_number $c->message->get_post_count(); $c->stash( view_posts => $view_posts, this_page => $this_page, - last_page => $last_page + last_page => $last_page, + post_count => $post_count ); $c->render(); diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep index 5b564dd..38a0055 100644 --- a/templates/layouts/default.html.ep +++ b/templates/layouts/default.html.ep @@ -28,8 +28,7 @@