summaryrefslogtreecommitdiff
path: root/views/inbox.erb
blob: a3e3f834e5e6ff56cc9db284a26ab3a48ff01f06 (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
49
50
  <!DOCTYPE html>
  <html lang='en'>
    <head>
      <link rel='stylesheet' type='text/css' href='/style.css'>
    </head>
    <body>
    <% @inbox.each_with_index do |file,i| %>
      <% item = JSON.parse(File.read(file))
         mention = mention(item['attributedTo'])
         following_path = File.join('public', 'following', mention + '.json') %>
     <b><a href='<%= item['attributedTo'] %>', target='_blank'><%= mention %></a></b>&nbsp;<i><%= item['published'].sub('T', ' ') %></i>
     <% File.exists?(following_path) ? method = 'unfollow' : method = 'follow' %>
      <form action='<%= File.join method, mention %>' method='post'>
        <button><%= method.capitalize %></button>
      </form>
      <p><%= 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 %>
      <p>
      <form action='<%= File.join 'delete', file %>' method='post'>
        <button>Delete</button>
      </form>
    <!--
      <form action='<%= File.join 'boost', file %>' method='post'>
        <button>Boost</button>
      </form>
      <form action='<%= File.join 'archive', file %>' method='post'>
        <button>Archive</button>
      </form>
      <form action='<%= File.join 'reply', file %>' method='post'>
        <button>Reply</button>
      </form>
    -->
      <hr>
    <% end %>
    </body>
  </html>