Show images, video, and audio attachments to notices.
This commit is contained in:
parent
1d8950798c
commit
748d800acb
5 changed files with 50 additions and 8 deletions
|
|
@ -36,6 +36,11 @@
|
|||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.activity-content img, video {
|
||||
max-width: 800px;
|
||||
max-height: 800px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: white;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
<%= case @mediaType do %>
|
||||
<% "audio" -> %>
|
||||
<audio src="<%= @url %>" controls="controls"></audio>
|
||||
<% "video" -> %>
|
||||
<video src="<%= @url %>" controls="controls"></video>
|
||||
<% _ -> %>
|
||||
<img src="<%= @url %>" alt="<%= @name %>" title="<%= @name %>">
|
||||
<% end %>
|
||||
|
|
@ -1,15 +1,29 @@
|
|||
<div class="activity">
|
||||
<%= render("user_card.html", %{user: @data.user}) %>
|
||||
<p class="pull-right">
|
||||
<a href="<%= @data.link %>" class="activity-link"><%= @data.published %></a></p>
|
||||
<div class="activity-content">
|
||||
<%= if @data.title != "" do %>
|
||||
<details>
|
||||
<summary><%= raw @data.title %></summary>
|
||||
<% end %>
|
||||
<details>
|
||||
<summary><%= raw @data.title %></summary>
|
||||
<div class="e-content"><%= raw @data.content %></div>
|
||||
</details>
|
||||
<% else %>
|
||||
<div class="e-content"><%= raw @data.content %></div>
|
||||
<%= if @data.title != "" do %>
|
||||
</details>
|
||||
<% end %>
|
||||
<p class="pull-right">
|
||||
<a href="<%= @data.link %>" class="activity-link"><%= @data.published %></a></p>
|
||||
<%= for %{"name" => name, "url" => [url | _]} <- @data.attachment do %>
|
||||
<%= if @data.sensitive do %>
|
||||
<details class="nsfw">
|
||||
<summary>sensitive media</summary>
|
||||
<div>
|
||||
<%= render("_attachment.html", %{name: name, url: url["href"],
|
||||
mediaType: fetch_media_type(url)}) %>
|
||||
</div>
|
||||
</details>
|
||||
<% else %>
|
||||
<%= render("_attachment.html", %{name: name, url: url["href"],
|
||||
mediaType: fetch_media_type(url)}) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue