wiki/lib/wiki_web/templates/page/show.html.eex

34 lines
1.1 KiB
Elixir
Raw Normal View History

2020-08-01 20:43:55 +00:00
<h1><%= @page.title %></h1>
2020-07-30 00:49:51 +00:00
<span><%= link "Edit", to: Routes.page_path(@conn, :edit, @page) %></span>
<span><%= link "Back", to: Routes.page_path(@conn, :index) %></span>
2020-08-01 20:43:55 +00:00
<div>
2020-08-01 23:37:16 +00:00
<%= raw(@page.html) %>
2020-08-01 20:43:55 +00:00
</div>
<%= for upload <- @page.uploads do %>
2021-04-11 02:05:06 +00:00
<div class="page-upload">
2020-08-01 20:43:55 +00:00
<%= cond do %>
<% String.starts_with?(upload.content_type, "image/") -> %>
<img src="<%= Routes.page_path(@conn, :get_upload, @page.id, upload.id) %>" />
<% String.starts_with?(upload.content_type, "video/") -> %>
<video controls src="<%= Routes.page_path(@conn, :get_upload, @page.id, upload.id) %>"></video>
<% String.starts_with?(upload.content_type, "audio/") -> %>
<audio controls src="<%= Routes.page_path(@conn, :get_upload, @page.id, upload.id) %>"></audio>
<% true -> %>
<a href="<%= Routes.page_path(@conn, :get_upload, @page.id, upload.id) %>"><%= upload.relative_path %></a>
<% end %>
</div>
<% end %>
2020-08-02 20:12:38 +00:00
<h2>Backlinks</h2>
<ul>
<%= for page <- @page.pages_linked_from do %>
<li>
<a href="<%= Routes.page_path(@conn, :show, page.id) %>">
<%= page.title %>
</a>
</li>
<% end %>
</ul>