Do if-markdown stuff in templates

This commit is contained in:
swagg boi 2025-04-12 12:05:28 -04:00
parent 817dbc046b
commit dafbd6bde4
4 changed files with 22 additions and 3 deletions

View File

@ -61,7 +61,6 @@ tests locally:
## TODOs ## TODOs
- Do the if-markdown-else-plaintext stuff in templates
- Fix preview tests - Fix preview tests
- Do I need `SUM` for `by_id()`? - Do I need `SUM` for `by_id()`?

View File

@ -25,7 +25,11 @@
</h4> </h4>
<h5 class="post__author"><%= $remark->{'author'} %></h5> <h5 class="post__author"><%= $remark->{'author'} %></h5>
<div class="post__body"> <div class="post__body">
<% if ($remark->{'markdown'}) { =%>
<%== markdown $remark->{'body'} =%> <%== markdown $remark->{'body'} =%>
<% } else { =%>
<span class="plain-text"><%= $remark->{'body'} %></span>
<% } =%>
</div> </div>
<nav class="post__nav"> <nav class="post__nav">
<%= link_to Thread => single_thread => <%= link_to Thread => single_thread =>

View File

@ -80,7 +80,11 @@
</h4> </h4>
<h5 class="post__author"><%= $last_remark->{'author'} %></h5> <h5 class="post__author"><%= $last_remark->{'author'} %></h5>
<div class="post__body"> <div class="post__body">
<span class="plain-text"><%= $last_remark->{'body'} =%></span> <% if ($last_remark->{'markdown'}) { =%>
<%== markdown $last_remark->{'body'} =%>
<% } else { =%>
<span class="plain-text"><%= $last_remark->{'body'} %></span>
<% } =%>
</div> </div>
<nav class="post__nav"> <nav class="post__nav">
<%= link_to Thread => single_thread => <%= link_to Thread => single_thread =>
@ -106,7 +110,11 @@
<h4 class="post__date"><%= $thread->{'date'} %></h4> <h4 class="post__date"><%= $thread->{'date'} %></h4>
<h5 class="post__author"><%= $thread->{'author'} %></h5> <h5 class="post__author"><%= $thread->{'author'} %></h5>
<div class="post__body"> <div class="post__body">
<span class="plain-text"><%= $thread->{'body'} =%></span> <% if ($thread->{'markdown'}) { =%>
<%== markdown $thread->{'body'} =%>
<% } else { =%>
<span class="plain-text"><%= $thread->{'body'} %></span>
<% } =%>
</div> </div>
<nav class="post__nav"> <nav class="post__nav">
<%= link_to post_remark => {thread_id => $thread->{'id'}}, <%= link_to post_remark => {thread_id => $thread->{'id'}},

View File

@ -24,7 +24,11 @@
<h4 class="post__date"><%= $thread->{'date'} %></h4> <h4 class="post__date"><%= $thread->{'date'} %></h4>
<h5 class="post__author"><%= $thread->{'author'} %></h5> <h5 class="post__author"><%= $thread->{'author'} %></h5>
<div class="post__body"> <div class="post__body">
<% if ($thread->{'markdown'}) { =%>
<%== markdown $thread->{'body'} =%> <%== markdown $thread->{'body'} =%>
<% } else { =%>
<span class="plain-text"><%= $thread->{'body'} %></span>
<% } =%>
</div> </div>
<nav class="post__nav"> <nav class="post__nav">
<%= link_to post_remark => {thread_id => $thread->{'id'}}, <%= link_to post_remark => {thread_id => $thread->{'id'}},
@ -55,7 +59,11 @@
</h4> </h4>
<h5 class="post__author"><%= $remark->{'author'} %></h5> <h5 class="post__author"><%= $remark->{'author'} %></h5>
<div class="post__body"> <div class="post__body">
<% if ($remark->{'markdown'}) { =%>
<%== markdown $remark->{'body'} =%> <%== markdown $remark->{'body'} =%>
<% } else { =%>
<span class="plain-text"><%= $remark->{'body'} %></span>
<% } =%>
</div> </div>
<nav class="post__nav"> <nav class="post__nav">
<%= link_to Remark => post_remark => <%= link_to Remark => post_remark =>