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

23 lines
936 B
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>
<%= raw(@content) %>
</div>
<%= for upload <- @page.uploads do %>
<div>
<%= 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 %>