summaryrefslogtreecommitdiff
path: root/views/item.erb
blob: 287054e3f8e19e520a8c7071619a49b63e89c656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<div style='margin-left:<%= @item[:indent] %>em' id='<%= @item[:nr] %>'>
  <b><a href='<%= @item[:actor_url] %>', target='_blank'><%= @item[:mention] %></a></b>&nbsp;
  <% if @item[:mention] != ACCOUNT %>
    <form action='<%= File.join @item[:follow], @item[:mention] %>' method='post'>
      <button><%= @item[:follow].capitalize %></button>
    </form>
    &nbsp;
    <form action='/delete' method='post'>
      <input type='hidden' name='file' value='<%= @item[:file] %>' />
      <input type='hidden' name='redirect' value='/<%= @dir.sub('inbox','') %>#<%= @item[:nr] %>' />
      <button>Delete</button>
    </form>
    <% if @dir == 'inbox' %>
      &nbsp;
      <form action='/archive' method='post'>
        <input type='hidden' name='file' value='<%= @item[:file] %>' />
        <input type='hidden' name='redirect' value='/<%= @dir.sub('inbox','') %>#<%= @item[:nr] %>' />
        <button>Archive</button>
      </form>
    <% end %>
  <% end %>
  <%= @item[:content] %>
  <% if @item[:attachment]
    @item[:attachment].each do |att|
      case att['mediaType']
      when /audio/ %>
        <br><audio controls=''><source src='<%= att['url'] %>' type='<%= att['mediaType'] %>'></audio>
      <% when /image/ %>
        <br><a href='<%= att['url'] %>'><img src='<%= att['url'] %>'></a>
      <% when /video/ %>
        <br><video controls=''><source src='<%= att['url'] %>' type='<%= att['mediaType'] %>'></video>
      <% else %>
        <%= att %><br>
        <a href='<%= att['url'] %>'><%= att['url'] %></a>
      <% end %>
    <% end %>
  <% end %>
  <form action='/outbox' method='post'>
    <input type='hidden' name='to' value='<%= @item[:actor_url] %>' />
    <input type='hidden' name='inReplyTo' value='<%= @item[:id] %>' />
    <input type='hidden' name='redirect' value='/<%= @dir.sub('inbox','') %>#<%= @item[:nr] %>' />
    <textarea name="content"></textarea>
    <input type="submit" value="Reply">
  </form>
</div>
<% @item[:replies].each do |reply| %>
  <%= html reply %>
<% end %>