diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/index.erb | 21 | ||||
-rw-r--r-- | views/item.erb | 39 |
2 files changed, 60 insertions, 0 deletions
diff --git a/views/index.erb b/views/index.erb new file mode 100644 index 0000000..269c495 --- /dev/null +++ b/views/index.erb @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<html lang='en'> + <head> + <link rel='stylesheet' type='text/css' href='/style.css'> + </head> + <body> + <h1><%= @dir %> + <form action='<%= @alt_dir %>' method='get'> + <button><%= @alt_name %></button> + </form> + </h1> + <% @threads.each do |item| %> + <%= html item %> + <% end %> + <% if @dir == 'inbox' %> + <form action='delete_all' method='post'> + <button>Delete all</button> + </form> + <% end %> + </body> +</html> 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> + <form action='<%= File.join @item[:follow], @item[:mention] %>' method='post'> + <button><%= @item[:follow].capitalize %></button> + </form> + + <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' %> + + <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 %> |