Skip to content

Commit 3bec9a7

Browse files
committed
Implement Reply model
1 parent a5599ce commit 3bec9a7

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

PostText.pl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# Load the local modules too
1111
use lib 'lib';
1212
use PostText::Model::Thread;
13+
use PostText::Model::Reply;
1314

1415
# Load Mojo plugins
1516
plugin 'Config';
@@ -25,6 +26,10 @@
2526
state $thread = PostText::Model::Thread->new(pg => shift->pg)
2627
};
2728

29+
helper reply => sub {
30+
state $reply = PostText::Model::Reply->new(pg => shift->pg)
31+
};
32+
2833
# Begin routing
2934
under sub ($c) {
3035
$c->session(expires => time() + 31536000);
@@ -94,7 +99,6 @@
9499
app->pg->migrations->from_dir('migrations')->migrate(4);
95100

96101
if (my $threads_per_page = app->config->{'threads_per_page'}) {
97-
say $threads_per_page;
98102
app->thread->threads_per_page($threads_per_page);
99103
}
100104

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Run the tests locally (against development environment)
2424

2525
## TODOs
2626

27+
1. Make a view for single threads(!!)
2728
1. Default 'threads per page' is broken if config file isn't correct
2829
(should pick up the default value wtf)
2930
1. Pick a date format
30-
1. Reply model

lib/PostText/Model/Reply.pm

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env perl
2+
3+
package PostText::Model::Reply;
4+
5+
use Mojo::Base -base, -signatures;
6+
7+
has 'pg';
8+
9+
sub new($class, $pg, $pg_reference) {
10+
bless {
11+
$pg => $pg_reference,
12+
replies_per_page => 5
13+
}, $class
14+
}
15+
16+
1;

0 commit comments

Comments
 (0)