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

70 lines
2.4 KiB
Elixir

<nav style="--bs-breadcrumb-divider: '>';" aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/">Overview</a></li>
<li class="breadcrumb-item"><a href="/r/<%= subreddit %>"><%= subreddit %></a></li>
<li class="breadcrumb-item"><a href="/r/<%= subreddit %>/<%= date %>"><%= date %></a></li>
<li class="breadcrumb-item active" aria-current="page">Post</li>
</ol>
</nav>
<h2><%= post.title %></h2>
<p>
<small><%= BdfrBrowser.RenderUtils.link_to_user(post.author) %></small>
-
<small><%= BdfrBrowser.RenderUtils.format_date(post.posted_at, :long) %></small>
-
<small><i class="bi bi-arrow-up-square"></i> <%= Float.round(post.upvote_ratio * 100, 1) %>%</small>
-
<a href="https://www.reddit.com<%= post.permalink %>" rel="noreferrer">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 %>