diff --git a/PostText.pl b/PostText.pl index d116c5e..ef5c1ef 100755 --- a/PostText.pl +++ b/PostText.pl @@ -10,6 +10,7 @@ use Data::Dumper; # For your debugging pleasure # Load the local modules too use lib 'lib'; use PostText::Model::Thread; +use PostText::Model::Reply; # Load Mojo plugins plugin 'Config'; @@ -25,6 +26,10 @@ helper thread => sub { state $thread = PostText::Model::Thread->new(pg => shift->pg) }; +helper reply => sub { + state $reply = PostText::Model::Reply->new(pg => shift->pg) +}; + # Begin routing under sub ($c) { $c->session(expires => time() + 31536000); @@ -94,7 +99,6 @@ app->secrets(app->config->{'secrets'}) || die $@; app->pg->migrations->from_dir('migrations')->migrate(4); if (my $threads_per_page = app->config->{'threads_per_page'}) { - say $threads_per_page; app->thread->threads_per_page($threads_per_page); } diff --git a/README.md b/README.md index 21e703f..fac8bc4 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Run the tests locally (against development environment) ## TODOs +1. Make a view for single threads(!!) 1. Default 'threads per page' is broken if config file isn't correct (should pick up the default value wtf) 1. Pick a date format -1. Reply model diff --git a/lib/PostText/Model/Reply.pm b/lib/PostText/Model/Reply.pm new file mode 100644 index 0000000..d94001b --- /dev/null +++ b/lib/PostText/Model/Reply.pm @@ -0,0 +1,16 @@ +#!/usr/bin/env perl + +package PostText::Model::Reply; + +use Mojo::Base -base, -signatures; + +has 'pg'; + +sub new($class, $pg, $pg_reference) { + bless { + $pg => $pg_reference, + replies_per_page => 5 + }, $class +} + +1;