From 4576163015c0cab4d1353aac9c4922b1d0dba849 Mon Sep 17 00:00:00 2001 From: swaggboi Date: Wed, 24 Aug 2022 00:21:18 -0400 Subject: [PATCH] A lil cleanup --- PostText.pl | 9 ++++----- templates/thread_id.html.ep | 34 +++++++++++++++++----------------- templates/view_page.html.ep | 3 +-- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/PostText.pl b/PostText.pl index 1cc6942..9b1fa12 100755 --- a/PostText.pl +++ b/PostText.pl @@ -121,7 +121,7 @@ group { # Gotta be a better way to name this route... return $c->redirect_to( - 'thread_idremark_page', + 'remark_page', {thread_id => $thread_id} ); } @@ -137,11 +137,10 @@ group { # Thread group { - under '/thread'; + under '/thread/:thread_id', [thread_id => qr/[0-9]+/]; - # This desperately needs clean-up - get '/:thread_id/:remark_page', - [thread_id => qr/[0-9]+/, remark_page => qr/[0-9]+/], + get '/:remark_page', + [remark_page => qr/[0-9]+/], {remark_page => 1}, sub ($c) { my $thread_id = $c->param('thread_id'); my $thread = $c->thread->get_thread_by_id($thread_id); diff --git a/templates/thread_id.html.ep b/templates/thread_id.html.ep index ab4f681..175afa0 100644 --- a/templates/thread_id.html.ep +++ b/templates/thread_id.html.ep @@ -13,21 +13,21 @@ <%= link_to Remark => thread_id => {thread_id => $thread->{'id'}} %> <% if (my $first_remark = @$remarks[0]) { =%> -
-

Remarks

- <% for my $remark (@$remarks) { =%> -
- #<%= %$remark{'id'} %> -

<%= %$remark{'date'} %>

-
<%= %$remark{'author'} %>
-

<%= %$remark{'body'} %>

-
- <% } =%> -
- +
+

Remarks

+ <% for my $remark (@$remarks) { =%> +
+ #<%= %$remark{'id'} %> +

<%= %$remark{'date'} %>

+
<%= %$remark{'author'} %>
+

<%= %$remark{'body'} %>

+
+ <% } =%> +
+ <% } =%> diff --git a/templates/view_page.html.ep b/templates/view_page.html.ep index 6bb0d87..440d5ce 100644 --- a/templates/view_page.html.ep +++ b/templates/view_page.html.ep @@ -5,8 +5,7 @@ <% for my $thread (@$threads) { =%>
- <%= link_to "#$thread->{'id'}", - thread_idremark_page => {thread_id => $thread->{'id'}} %> + <%= link_to "#$thread->{'id'}", remark_page => {thread_id => $thread->{'id'}} %>

<%= %$thread{'title'} %>

<%= %$thread{'date'} %>