diff --git a/PostText.pl b/PostText.pl index 155c42d..7234fbd 100755 --- a/PostText.pl +++ b/PostText.pl @@ -45,7 +45,7 @@ group { under 'view'; get '/:page', [page => qr/[0-9]+/], {page => 1}, sub ($c) { - my $base_path = '/view'; + my $base_path = $c->match->path_for(page => undef)->{'path'}; my $this_page = $c->param('page'); my $last_page = $c->thread->get_last_page(); my $threads = $c->thread->get_threads_by_page($this_page); @@ -128,6 +128,10 @@ if (my $threads_per_page = app->config->{'threads_per_page'}) { app->thread->threads_per_page($threads_per_page); } +if (my $remarks_per_page = app->config->{'remarks_per_page'}) { + app->remark->remarks_per_page($remarks_per_page); +} + app->asset->process('main.css', 'css/PostText.css'); # Send it diff --git a/lib/PostText/Model/Remark.pm b/lib/PostText/Model/Remark.pm index 91e9de5..6976a74 100644 --- a/lib/PostText/Model/Remark.pm +++ b/lib/PostText/Model/Remark.pm @@ -29,4 +29,8 @@ sub get_remarks_by_thread_id($self, $thread_id) { END_SQL } +sub remarks_per_page($self, $value = undef) { + $self->{'remarks_per_page'} = $value // $self->{'remarks_per_page'}; +} + 1;