Create 'about' and 'rules' pages

This commit is contained in:
swag 2023-04-25 22:28:11 -04:00
parent 419c61ed7f
commit c7d00e834e
11 changed files with 96 additions and 8 deletions

View File

@ -96,6 +96,11 @@ sub startup($self) {
# Root redirect # Root redirect
$r->get('/', sub ($c) { $c->redirect_to('threads_list') }); $r->get('/', sub ($c) { $c->redirect_to('threads_list') });
# Static pages
$r->get('/about')->to('page#about')->name('about_page');
$r->get('/rules')->to('page#rules')->name('rules_page');
# Thread # Thread
my $thread = $r->any('/thread'); my $thread = $r->any('/thread');

View File

@ -0,0 +1,9 @@
package PostText::Controller::Page;
use Mojo::Base 'Mojolicious::Controller', -signatures;
sub about($self) { $self->render }
sub rules($self) { $self->render }
'false';

View File

@ -127,4 +127,4 @@ subtest Login => sub {
}; };
}; };
done_testing(); done_testing;

View File

@ -136,4 +136,4 @@ subtest Login => sub {
}; };
}; };
done_testing(); done_testing;

11
t/page.t Normal file
View File

@ -0,0 +1,11 @@
use Mojo::Base -strict;
use Test::More;
use Test::Mojo;
my $t = Test::Mojo->new('PostText');
$t->get_ok('/about')->status_is(200)->text_like(h2 => qr/About Post::Text/);
$t->get_ok('/rules')->status_is(200)->text_like(h2 => qr/The Rules/);
done_testing;

View File

@ -53,4 +53,4 @@ subtest 'Flagging remark', sub {
->text_like(p => qr/Remark #1 has been flagged/); ->text_like(p => qr/Remark #1 has been flagged/);
}; };
done_testing(); done_testing;

View File

@ -6,4 +6,4 @@ my $t = Test::Mojo->new('PostText');
$t->get_ok('/')->status_is(302)->header_like(Location => qr/thread/); $t->get_ok('/')->status_is(302)->header_like(Location => qr/thread/);
done_testing(); done_testing;

View File

@ -100,4 +100,4 @@ subtest 'Flagging thread', sub {
->text_like(p => qr/Thread #1 has been flagged/); ->text_like(p => qr/Thread #1 has been flagged/);
}; };
done_testing(); done_testing;

View File

@ -10,6 +10,8 @@
<div> <div>
<%= link_to List => threads_list => {list_page => 1} %> <%= link_to List => threads_list => {list_page => 1} %>
<%= link_to New => 'post_thread' %> <%= link_to New => 'post_thread' %>
<%= link_to About => 'about_page' %>
<%= link_to Rules => 'rules_page' %>
<%= link_to RSS => threads_feed => {format => 'rss'} %> <%= link_to RSS => threads_feed => {format => 'rss'} %>
<% unless (is_mod) { =%> <% unless (is_mod) { =%>
<span class="login"> <span class="login">

View File

@ -0,0 +1,39 @@
% layout 'default';
% title 'About Post::Text';
<h2><%= title %></h2>
<div class="about body">
<p>Post::Text is a <a href="">textboard</a> a bit like 2channel. You
can post whatever you want anonymously just please mind the
<%= link_to rules => 'rules_page' %>. Markdown is supported for
formatting posts using the
<a href="https://daringfireball.net/projects/markdown/syntax">
original implementation from The Daring Fireball</a>. For
example, back-ticks are for <em>inline code</em> while
indentation should be used if you want an entire code bock:</p>
<pre><code>
This is `inline_code()` and so is ```this()```. This is incorrect:
```
if (true) {
do_stuff();
}
```
This is correct for a multi-line code block:
if (true) {
do_stuff();
}
You can use an actual tab character or four spaces to indent.
</code></pre>
<p>There is a button for users to 'flag' a post for review by a
moderator. If you need further assistance you can reach out to the
<a href="mailto:swaggboi@slackware.uk">webmaster</a>. There is
also a 'bump' button you're free to use and abuse to your heart's
content. If you're already using a feed reader or some sort of
email client you can check out the
<%= link_to 'RSS feed', threads_feed => {format => 'rss'} %>.</p>
<p>Click 'New' in the top navigation bar to start a new thread and
make some <s>enemies</s> friends!</p>
</div>

View File

@ -0,0 +1,22 @@
% layout 'default';
% title 'The Rules™';
<h2><%= title %></h2>
<div class="rules body">
<p>The rules here are pretty simple:</p>
<ul>
<li>No hate speech (e.g. racism, sexism, homophobia, transphobia, etc.)</li>
<li>No advertising/spam.</li>
<li>This is our web site, and we will do as we please with it. If
you don't like how we run our site, you are free to set up your
own.</li>
<li>You grant us a non-exclusive, perpetual, world-wide,
irrevocable, no-charge, royalty-free copyright license to
reproduce, prepare derivative works of, publicly display, publicly
perform, sublicense, and distribute content you post here.</li>
<li>We do not promise to preserve anyone's content for any
particular length of time. If you want to preserve content
(whether your own or someone else's) from this web site, you
should download your own copy of that content.</li>
<li>You are liable for what you post, and we are not liable for it.</li>
<li>We may modifiy these rules at any time.</li>
</div>