% layout 'default'; % title 'Search Posts';

<%= title %>

<% if (my $error = validation->error('q')) { =%>

Must be between <%= $error->[2] %> and <%= $error->[3] %> characters.

<% } =%> <%= label_for search => 'Search' %> <%= text_field q => ( id => 'search', maxlength => 2047, minlength => 1, required => undef ) %>
<% if (scalar @{$search_results}) { =%>

Results

<% for my $result (@{$search_results}) { =%>

<%= $result->{'post_date'} %> <% if ($result->{'post_type'} eq 'thread') { =%> <%= link_to "#$result->{'post_id'}", single_thread => {thread_id => $result->{'post_id'}}, (class => 'post__id') %> <% } else { =%> <%= link_to "#$result->{'post_id'}", single_remark => {remark_id => $result->{'post_id'}}, (class => 'post__id') %> <% } =%>

<%== markdown $result->{'post_body'} =%>
<% } =%> <% if ($last_page && $last_page != 1) { =%> <% } =%>
<% } =%>