From 8ea06cf0ebd4f5e8c5e02675559e9db2ce761d65 Mon Sep 17 00:00:00 2001 From: swaggboi Date: Mon, 22 Aug 2022 16:37:38 -0400 Subject: [PATCH] Remove this hard-coded path stuff --- PostText.pl | 6 +++++- lib/PostText/Model/Remark.pm | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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;