Add nsfw banner to attachments
This commit is contained in:
parent
ba9b93bba8
commit
825b4ffd92
3 changed files with 25 additions and 1 deletions
|
@ -1,4 +1,9 @@
|
||||||
<a class="attachment" href="<%= @url %>">
|
<a class="attachment" href="<%= @url %>">
|
||||||
|
<%= if @nsfw do %>
|
||||||
|
<div class="nsfw-banner" alt="<%= @name %>" title="<%= @name %>">
|
||||||
|
<div><%= gettext("Hover to show content") %></div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
<%= case @mediaType do %>
|
<%= case @mediaType do %>
|
||||||
<% "audio" -> %>
|
<% "audio" -> %>
|
||||||
<audio class="u-audio" src="<%= @url %>" controls="controls"></audio>
|
<audio class="u-audio" src="<%= @url %>" controls="controls"></audio>
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<div class="attachments">
|
<div class="attachments">
|
||||||
<%= for %{"name" => name, "url" => [url | _]} <- @attachment do %>
|
<%= for %{"name" => name, "url" => [url | _]} <- @attachment do %>
|
||||||
<%= render("_attachment.html", %{name: name, url: url["href"],
|
<%= render("_attachment.html", %{name: name, url: url["href"],
|
||||||
mediaType: fetch_media_type(url)}) %>
|
mediaType: fetch_media_type(url), nsfw: @sensitive}) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -442,6 +442,7 @@ .attachment {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
position: relative;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,3 +465,21 @@ .fa-icon {
|
||||||
.status-actions .fa-icon {
|
.status-actions .fa-icon {
|
||||||
height: 1.1em;
|
height: 1.1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nsfw-banner {
|
||||||
|
position: absolute;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.nsfw-banner div {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nsfw-banner:not(:hover) {
|
||||||
|
background-color: var(--background);
|
||||||
|
}
|
||||||
|
.nsfw-banner:hover div {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue