23 lines
938 B
Elixir
23 lines
938 B
Elixir
<h1><%= @page.title %></h1>
|
|
<span><%= link "Edit", to: Routes.page_path(@conn, :edit, @page) %></span>
|
|
<span><%= link "Back", to: Routes.page_path(@conn, :index) %></span>
|
|
|
|
<div>
|
|
<%= raw(@page.html) %>
|
|
</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 %>
|