feat: Link directly to comments

This commit is contained in:
Daniel Kempkens 2023-10-04 20:59:52 +02:00
parent e0107a3d81
commit a19c4f6a36
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM
4 changed files with 10 additions and 3 deletions

View file

@ -28,6 +28,7 @@ defmodule BdfrBrowser.Comment do
join: p in assoc(c, :post),
join: s in assoc(p, :subreddit),
select: %{
id: c.id,
body: c.body,
children: [],
posted_at: c.posted_at,
@ -51,6 +52,7 @@ defmodule BdfrBrowser.Comment do
join: p in assoc(c, :post),
join: s in assoc(p, :subreddit),
select: %{
id: c.id,
author: c.author,
body: c.body,
children: [],
@ -73,6 +75,7 @@ defmodule BdfrBrowser.Comment do
join: p in assoc(c, :post),
join: s in assoc(p, :subreddit),
select: %{
id: c.id,
author: c.author,
body: c.body,
children: [],

View file

@ -1,4 +1,4 @@
<div style="padding-left: <%= level * 5 %>px; margin-bottom: 2px;">
<div style="padding-left: <%= level * 5 %>px; margin-bottom: 2px;" id="cmt-<%= comment.id %>">
<div class="card">
<div class="card-body" style="padding: 8px;">
<blockquote class="blockquote mb-0" style="font-size: 1rem;">

View file

@ -54,7 +54,9 @@
<footer class="blockquote-footer">
<%= BdfrBrowser.RenderUtils.link_to_user(comment.author) %>,
<a href="/r/<%= comment.subreddit %>/<%= comment.post_date %>/<%= comment.post_id %>"><%= comment.post_title %></a>,
<a href="/r/<%= comment.subreddit %>/<%= comment.post_date %>/<%= comment.post_id %>#cmt-<%= comment.id %>">
<%= comment.post_title %>
</a>,
<a href="/r/<%= comment.subreddit %>/<%= comment.post_date %>/"><%= comment.subreddit %></a>,
<small><%= DateTime.to_iso8601(comment.posted_at) %></small>
</footer>

View file

@ -59,7 +59,9 @@
<%= BdfrBrowser.RenderUtils.comment(comment.body) %>
<footer class="blockquote-footer">
<a href="/r/<%= comment.subreddit %>/<%= comment.post_date %>/<%= comment.post_id %>"><%= comment.post_title %></a>,
<a href="/r/<%= comment.subreddit %>/<%= comment.post_date %>/<%= comment.post_id %>#cmt-<%= comment.id %>">
<%= comment.post_title %>
</a>,
<a href="/r/<%= comment.subreddit %>/<%= comment.post_date %>/"><%= comment.subreddit %></a>,
<small><%= DateTime.to_iso8601(comment.posted_at) %></small>
</footer>