This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
bdfr-browser/priv/templates/http/post.eex

59 lines
1.8 KiB
Elixir

<h2><%= post.title %></h2>
<p>
<small><a href="/user/<%= post.author %>"><%= post.author %></a></small>
-
<small><%= DateTime.to_iso8601(post.posted_at) %></small>
-
<a href="https://reddit.com<%= post.permalink %>">Open reddit</a>
</p>
<%= unless is_nil(post.selftext) do %>
<div class="row">
<blockquote class="blockquote mb-0">
<%= BdfrBrowser.RenderUtils.selftext(post.selftext) %>
</blockquote>
</div>
<br>
<% end %>
<%= unless Enum.empty?(media.images) do %>
<div id="carouselImages" class="carousel slide">
<div class="carousel-inner">
<%= for {img, i} <- Enum.with_index(media.images) do %>
<div class="carousel-item <%= if i == 0, do: "active" %>">
<img src="<%= img %>" class="d-block w-100">
</div>
<% end %>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselImages" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselImages" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
<br>
<% end %>
<%= unless Enum.empty?(media.videos) do %>
<div class="row">
<%= for video <- media.videos do %>
<video controls loop>
<source src="<%= video %>" type="video/mp4">
</video>
<% end %>
</div>
<br>
<% end %>
<%= for comment when is_nil(comment.parent_id) <- post.comments do %>
<div class="row" style="margin-bottom: 4px;">
<div class="d-grid gap-2 col-12 mx-auto">
<%= EEx.eval_file(comment_template, comment: comment, level: 0, comment_template: comment_template) %>
</div>
</div>
<% end %>