summaryrefslogtreecommitdiff
path: root/views/item.erb
diff options
context:
space:
mode:
authorpdp8 <pdp8@pdp8.info>2023-06-21 10:32:41 +0200
committerpdp8 <pdp8@pdp8.info>2023-06-21 10:32:41 +0200
commitb837b19b1950c7bc14a38aa5ea917e91b6f081dd (patch)
tree3805eebb26ce716c241e00091f5788fb750bf716 /views/item.erb
parentc719909e458d9896ec777b25fe8620df3eb9ff7a (diff)
erb templates separated
Diffstat (limited to 'views/item.erb')
-rw-r--r--views/item.erb39
1 files changed, 39 insertions, 0 deletions
diff --git a/views/item.erb b/views/item.erb
new file mode 100644
index 0000000..aafc4cc
--- /dev/null
+++ b/views/item.erb
@@ -0,0 +1,39 @@
+<div style='margin-left:<%= @item[:indent] %>em' id='<%= @item[:nr] %>'>
+ <b><a href='<%= @item[:actor_url] %>', target='_blank'><%= @item[:mention] %></a></b>&nbsp;
+ <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' id='file' value='<%= @item[:file] %>' />
+ <input type='hidden' name='redirect' id='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' id='file' value='<%= @item[:file] %>' />
+ <input type='hidden' name='redirect' id='redirect' value='/<%= @dir.sub('inbox','') %>#<%= @item[:nr] %>' />
+ <button>Archive</button>
+ </form>
+ <% 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 %>
+</div>
+<% @item[:replies].each do |reply| %>
+ <%= html reply %>
+<% end %>