summaryrefslogtreecommitdiff
path: root/views/collection.erb
blob: 8dd3878ffd3eb32764e767381383311fb9036f19 (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
<!DOCTYPE html>
<html lang='en'>
  <head>
    <link rel='stylesheet' type='text/css' href='/style.css'>
  </head>
  <body>
    <h1><%= @dir %>
    <% dirs = ['inbox','outbox','archive']
      dirs.delete(@dir)
      dirs.each do |d| %>
      <form action='/<%= d %>' method='get'>
        <button><%= d %></button>
      </form>
    <% end %>
    </h1>
    <% @threads.each do |object|
       @object = object %>
      <%= erb :object %>
    <% end %>
    <form action='/delete' method='post'>
      <button>Delete all</button>
    </form>
  </body>
  <script>
    const reply_buttons = document.querySelectorAll(".reply");
    for (const button of reply_buttons) {
      button.addEventListener('click', function() {
        const form = document.getElementById('form' + button.getAttribute('data-index'));
        button.style.display = 'none';
        form.style.display = 'block';
      });
    };
    const cancel_buttons = document.querySelectorAll(".cancel");
    for (const button of cancel_buttons) {
      button.addEventListener('click', function() {
        const form = document.getElementById('form' + button.getAttribute('data-index'));
        button.style.display = 'block';
        form.style.display = 'none';
      });
    };
  </script>
</html>