move to 2.5.5
[anni] / lib / pleroma / web / templates / embed / show.html.eex
1 <div>
2   <div class="p-author h-card">
3     <a class="u-url" rel="author noopener" href="<%= @author.ap_id %>">
4       <div class="avatar">
5         <img src="<%= User.avatar_url(@author) |> MediaProxy.url %>" width="48" height="48" alt="">
6       </div>
7       <span class="display-name" style="padding-left: 0.5em;">
8         <bdi><%= raw (@author.name |> Formatter.emojify(@author.emoji)) %></bdi>
9         <span class="nickname">@<%= full_nickname(@author) %></span>
10       </span>
11     </a>
12   </div>
13
14   <div class="activity-content" >
15     <%= if status_title(@activity) != "" do %>
16       <details <%= if open_content?() do %>open<% end %>>
17         <summary><%= raw status_title(@activity) %></summary>
18         <div><%= activity_content(@activity) %></div>
19       </details>
20     <% else %>
21       <div><%= activity_content(@activity) %></div>
22     <% end %>
23     <%= for %{"name" => name, "url" => [url | _]} <- attachments(@activity) do %>
24       <div class="attachment">
25       <%= if sensitive?(@activity) do %>
26         <details class="nsfw">
27           <summary onClick="updateHeight()"><%= Gettext.gettext("sensitive media") %></summary>
28           <div class="nsfw-content">
29             <%= render("_attachment.html", %{name: name, url: url["href"],
30                                              mediaType: fetch_media_type(url)}) %>
31           </div>
32         </details>
33       <% else %>
34         <%= render("_attachment.html", %{name: name, url: url["href"],
35                                          mediaType: fetch_media_type(url)}) %>
36       <% end %>
37       </div>
38     <% end %>
39   </div>
40
41   <dl class="counts pull-right">
42     <dt><%= Gettext.gettext("replies") %></dt><dd><%= @counts.replies %></dd>
43     <dt><%= Gettext.gettext("announces") %></dt><dd><%= @counts.announces %></dd>
44     <dt><%= Gettext.gettext("likes") %></dt><dd><%= @counts.likes %></dd>
45   </dl>
46
47   <p class="date pull-left">
48     <%= link published(@activity), to: activity_url(@author, @activity) %>
49   </p>
50 </div>
51
52 <script>
53 function updateHeight() {
54   window.requestAnimationFrame(function(){
55     var height = document.getElementsByTagName('html')[0].scrollHeight;
56
57     window.parent.postMessage({
58       type: 'setHeightPleromaEmbed',
59       id: window.parentId,
60       height: height,
61     }, '*');
62   })
63 }
64
65 window.addEventListener('message', function(e){
66   var data = e.data || {};
67
68   if (!window.parent || data.type !== 'setHeightPleromaEmbed') {
69     return;
70   }
71
72   window.parentId = data.id
73
74   updateHeight()
75 });
76 </script>