Some template cleanup and semantic HTML changes

This commit is contained in:
swagg boi 2023-05-09 20:07:28 -04:00
parent 625843af53
commit 079910ad68
12 changed files with 115 additions and 163 deletions

View file

@ -58,6 +58,9 @@ Run the tests locally (against development environment):
## TODOs
1. Show `bump_tally` and `remark_count` in single thread view
1. Rename `remark_count` to `remark_tally`
1. Redirect mod/admin back to hidden/flagged where it makes sense
1. CSS
1. "All new posts flagged" mode (require approval for new posts)
1. Tests for mod-only user?

View file

@ -13,74 +13,10 @@
border-collapse: collapse;
}
.thread .id, .remark .id, .thread .flag, nav .login {
.thread .id, .remark .id, nav .flag, nav .login {
float: right;
}
code {
pre {
white-space: pre-wrap;
}
/*
* For the custom Markdown <h1> - <h6>
*/
span.head1 {
display: block;
font-size: 2em;
margin-top: 0.67em;
margin-bottom: 0.67em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}
span.head2 {
display: block;
font-size: 1.5em;
margin-top: 0.83em;
margin-bottom: 0.83em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}
span.head3 {
display: block;
font-size: 1.17em;
margin-top: 1em;
margin-bottom: 1em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}
span.head4 {
display: block;
font-size: 1em;
margin-top: 1.33em;
margin-bottom: 1.33em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}
span.head5 {
display: block;
font-size: .83em;
margin-top: 1.67em;
margin-bottom: 1.67em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}
span.head6 {
display: block;
font-size: .67em;
margin-top: 2.33em;
margin-bottom: 2.33em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}

View file

@ -5,9 +5,9 @@
<%= asset 'main.css' %>
</head>
<body>
<h1>Post::Text</h1>
<nav>
<div>
<header>
<h1>Post::Text</h1>
<nav>
<%= link_to List => threads_list => {list_page => 1} %>
<%= link_to New => 'post_thread' %>
<%= link_to About => 'about_page' %>
@ -20,17 +20,17 @@
<%= link_to Login => 'mod_login' %>
<% } =%>
</span>
</div>
</nav>
<% if (is_mod) { =%>
<div>
<nav>
<span>Moderate:</span>
<%= link_to Flagged => 'flagged_list' %>
<%= link_to Hidden => 'hidden_list' %>
<%= link_to Reset => 'mod_reset' %>
</div>
</nav>
<% } =%>
<% if (is_admin) { =%>
<div>
<nav>
<span>Admin:</span>
<%= link_to Create => 'create_mod' %>
<%= link_to Reset => 'admin_reset' %>
@ -38,9 +38,9 @@
<%= link_to Unlock => 'unlock_mod' %>
<%= link_to Promote => 'promote_mod' %>
<%= link_to Demote => 'demote_admin' %>
</div>
</nav>
<% } =%>
</nav>
</header>
<hr>
<% if (flash 'error') { =%>
<p class="field-with-error" id="error"><%= flash 'error' %></p>
@ -49,8 +49,7 @@
<% } =%>
<% if (flash 'info') { =%>
<p class="field-with-info" id="info"><%= flash 'info' %></p>
<% } =%>
<% if (stash 'info') { =%>
<% } elsif (stash 'info') { =%>
<p class="field-with-info" id="info"><%= stash 'info' %></p>
<% } =%>
<%= content =%>

View file

@ -1,10 +1,12 @@
% layout 'default';
% title 'Flagged Posts';
<h2><%= title %></h2>
<% if ($post_links->[0]) { =%>
<ul>
<% for my $link (@{$post_links}) { =%>
<li><%= link_to $link, $link %></li>
<main>
<% if ($post_links->[0]) { =%>
<ul>
<% for my $link (@{$post_links}) { =%>
<li><%= link_to $link, $link %></li>
<% } =%>
</ul>
<% } =%>
</ul>
<% } =%>
</main>

View file

@ -1,10 +1,12 @@
% layout 'default';
% title 'Hidden Posts';
<h2><%= title %></h2>
<% if ($post_links->[0]) { =%>
<ul>
<% for my $link (@{$post_links}) { =%>
<li><%= link_to $link, $link %></li>
<main>
<% if ($post_links->[0]) { =%>
<ul>
<% for my $link (@{$post_links}) { =%>
<li><%= link_to $link, $link %></li>
<% } =%>
</ul>
<% } =%>
</ul>
<% } =%>
</main>

View file

@ -1,4 +0,0 @@
% layout 'default';
% title 'Top Secret';
<h2><%= title %></h2>
<p>For mods only!!</p>

View file

@ -1,12 +1,13 @@
% 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">
<main class="about body">
<p>Post::Text is a
<a href="https://en.wikipedia.org/wiki/Textboard">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>
@ -28,7 +29,7 @@ This is correct for a multi-line code block:
<p>You can use an actual tab character or four spaces to indent.
<strong>Only Markdown is supported, HTML will be filtered
out.</strong></p>
<p>There is a button for users to 'flag' a post for review by a
<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
@ -36,5 +37,5 @@ This is correct for a multi-line code block:
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>
make some <del>enemies</del> <ins>friends</ins>!</p>
</main>

View file

@ -1,7 +1,7 @@
% layout 'default';
% title 'The Rules™';
<h2><%= title %></h2>
<div class="rules body">
<main class="rules body">
<p>The rules here are pretty simple:</p>
<ul>
<li>No hate speech (e.g. racism, sexism, homophobia, transphobia, etc.)</li>
@ -19,4 +19,5 @@
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>
</ul>
</main>

View file

@ -1,24 +1,26 @@
% layout 'default';
% title "Remark #$remark->{'id'}";
<h2><%= title %></h2>
<div class="remarks">
<main class="remarks">
<article class="remark">
<nav class="id">#<%= $remark->{'id'} %></nav>
<h4 class="date"><%= $remark->{'date'} %></h4>
<h5 class="author"><%= $remark->{'author'} %></h5>
<div class="body">
<%== markdown $remark->{'body'} =%>
</div>
<nav>
<%= link_to Thread => single_thread => {thread_id => $remark->{'thread_id'}} %>
<%= link_to Remark => post_remark => {thread_id => $remark->{'thread_id'}} %>
<span class="flag">
<%= link_to Flag => flag_remark => {remark_id => $remark->{'id'}} %>
</span>
</nav>
<% if (is_mod) { =%>
<nav>
<%= link_to Hide => hide_remark => {remark_id => $remark->{'id'}} %>
<%= link_to Unhide => unhide_remark => {remark_id => $remark->{'id'}} %>
<%= link_to Unflag => unflag_remark => {remark_id => $remark->{'id'}} %>
</nav>
<% } =%>
</article>
</div>
<nav>
<%= link_to Thread => single_thread => {thread_id => $remark->{'thread_id'}} %>
<%= link_to Flag => flag_remark => {remark_id => $remark->{'id'} } %>
</nav>
<% if (is_mod) { =%>
<nav>
<%= link_to Hide => hide_remark => {remark_id => $remark->{'id'}} %>
<%= link_to Unhide => unhide_remark => {remark_id => $remark->{'id'}} %>
<%= link_to Unflag => unflag_remark => {remark_id => $remark->{'id'}} %>
</nav>
<% } =%>
</main>

View file

@ -27,34 +27,40 @@
</div>
<%= submit_button 'Post', class => 'post button' %>
</form>
<div class="threads">
<section class="threads">
<h3>Thread</h3>
<article class="thread">
<nav class="id">
<%= link_to "#$thread->{'id'}",
<h3 class="title">
<%= link_to single_thread => {thread_id => $thread->{'id'}}, begin %>
<%= $thread->{'title'} %>
<% end %>
<span class="id">
<%= link_to "#$thread->{'id'}",
single_thread => {thread_id => $thread->{'id'}} %>
</nav>
<h3 class="title"><%= $thread->{'title'} %></h3>
</span>
</h3>
<h4 class="date"><%= $thread->{'date'} %></h4>
<h5 class="author"><%= $thread->{'author'} %></h5>
<div class="body">
<%== markdown $thread->{'body'} =%>
</div>
</article>
</div>
</section>
<% if (my $last_remark_id = $last_remark->{'id'}) { =%>
<div class="remarks">
<section class="remarks">
<h3>Last Remark</h3>
<article class="remark">
<nav class="id">
<%= link_to "#$last_remark_id",
single_remark => {remark_id => $last_remark_id} %>
</nav>
<h4 class="date"><%= $last_remark->{'date'} %></h4>
<h4 class="date">
<%= $last_remark->{'date'} %>
<span class="id">
<%= link_to "#$last_remark_id",
single_remark => {remark_id => $last_remark_id} %>
</span>
</h4>
<h5 class="author"><%= $last_remark->{'author'} %></h5>
<div class="body">
<%== markdown $last_remark->{'body'} =%>
</div>
</article>
</div>
</section>
<% } =%>

View file

@ -1,7 +1,7 @@
% layout 'default';
% title "Thread #$thread->{'id'}";
<h2><%= title %></h2>
<div class="threads">
<main class="threads">
<article class="thread">
<h3 class="title"><%= $thread->{'title'} %></h3>
<h4 class="date"><%= $thread->{'date'} %></h4>
@ -9,43 +9,47 @@
<div class="body">
<%== markdown $thread->{'body'} =%>
</div>
<nav>
<%= link_to Remark => post_remark => {thread_id => $thread->{'id'}} %>
<%= link_to Bump => bump_thread => {thread_id => $thread->{'id'}} %>
<span class="flag">
<%= link_to Flag => flag_thread => {thread_id => $thread->{'id'}} %>
</span>
</nav>
<% if (is_mod) { =%>
<nav>
<%= link_to Hide => hide_thread => {thread_id => $thread->{'id'}} %>
<%= link_to Unhide => unhide_thread => {thread_id => $thread->{'id'}} %>
<%= link_to Unflag => unflag_thread => {thread_id => $thread->{'id'}} %>
</nav>
<% } =%>
</article>
</div>
<nav>
<%= link_to Remark => post_remark => {thread_id => $thread->{'id'}} %>
<%= link_to Bump => bump_thread => {thread_id => $thread->{'id'}} %>
<%= link_to Flag => flag_thread => {thread_id => $thread->{'id'}} %>
</nav>
<% if (is_mod) { =%>
<nav>
<%= link_to Hide => hide_thread => {thread_id => $thread->{'id'}} %>
<%= link_to Unhide => unhide_thread => {thread_id => $thread->{'id'}} %>
<%= link_to Unflag => unflag_thread => {thread_id => $thread->{'id'}} %>
</nav>
<% } =%>
</main>
<% if (my $first_remark = $remarks->[0]) { =%>
<div class="remarks" id="remarks">
<section class="remarks" id="remarks">
<h3>Remarks</h3>
<% for my $remark (@{$remarks}) { =%>
<article class="remark">
<nav class="id">
<%= link_to "#$remark->{'id'}",
single_remark => {remark_id => $remark->{'id'}} %>
</nav>
<h4 class="date"><%= $remark->{'date'} %></h4>
<h4 class="date">
<%= $remark->{'date'} %>
<span class="id">
<%= link_to "#$remark->{'id'}",
single_remark => {remark_id => $remark->{'id'}} %>
</span>
</h4>
<h5 class="author"><%= $remark->{'author'} %></h5>
<div class="body">
<%== markdown $remark->{'body'} =%>
</div>
<nav class="flag">
<%= link_to Flag => flag_remark => {remark_id => $remark->{'id'}} %>
<nav>
<%= link_to Remark => post_remark => {thread_id => $thread->{'id'}} %>
<span class="flag">
<%= link_to Flag => flag_remark => {remark_id => $remark->{'id'}} %>
</span>
</nav>
</article>
<% } =%>
</div>
<nav>
<%= link_to Remark => post_remark => {thread_id => $thread->{'id'}} %>
</nav>
</section>
<nav>
<% if ($last_page && $last_page != 1) { =%>
<%= pagination $this_page, $last_page, ($base_path . '/{page}') %>

View file

@ -1,17 +1,17 @@
% layout 'default';
% title 'Threads List';
<h2><%= title %></h2>
<div class="threads">
<main class="threads">
<% for my $thread (@{$threads}) { =%>
<article class="thread">
<nav class="id">
<%= link_to "#$thread->{'id'}",
single_thread => {thread_id => $thread->{'id'}} %>
</nav>
<h3 class="title">
<%= link_to single_thread => {thread_id => $thread->{'id'}}, begin %>
<%= $thread->{'title'} %>
<% end %>
<span class="id">
<%= link_to "#$thread->{'id'}",
single_thread => {thread_id => $thread->{'id'}} %>
</span>
</h3>
<h4 class="date"><%= $thread->{'date'} %></h4>
<h5 class="author"><%= $thread->{'author'} %></h5>
@ -32,7 +32,7 @@
</nav>
</article>
<% } =%>
</div>
</main>
<% if ($last_page && $last_page != 1) { =%>
<nav>
<%= pagination $this_page, $last_page, ($base_path . '/{page}') %>