summaryrefslogtreecommitdiff
path: root/app/views/runs/show.html.erb
blob: d7d65b63724787ed21e39c1a177b7e88a58aa7f8 (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
<div class="space-y-4">
  <div class="space-y-2">
    <h1 class="text-2xl"><%= @run.title %></h1>
    <p class="subtitle"><%= @run.game.title %></p>
    <p>Started by <%= link_to @run.user.name || "???", user_path(@run.user) %>
      <%= time_ago_in_words(@run.created_at) %> ago.</p>
  </div>

  <div class="font-bold">
    This run is currently
    <% if @run.checked_in? %>
      checked in! You can progress this run <%= link_to "by creating a checkpoint", new_run_checkpoint_path(@run) %>.
    <% else %>
      checked out by <%= link_to @run.checked_out_user.name || "???", user_path(@run.checked_out_user) %>.
      <% if @run.last_save_file.attached? %>
        You can
        <%= link_to "download the last save file", rails_blob_path(@run.last_save_file, disposition: "attachment") %>
        to check it out, but you won't be able to check in any progress.
      <% end %>
    <% end %>
  </div>

  <h2 class="text-xl">Checkpoints</h2>
  <%= link_to "New checkpoint", new_run_checkpoint_path(@run) %>

  <div class="border-l border-orange-900 p-2">
    <% @run.checkpoints.each do |checkpoint| %>
      <div class="flex flex-col">
        <div>
          <%= time_ago_in_words(checkpoint.created_at) %> ago by
          <%= link_to checkpoint.user.name || "???", user_path(checkpoint.user) %>
        </div>
        <div class="text-sm">
          <span><%= checkpoint.created_at %></span>
          <% if checkpoint.save_file.attached? %>
            <%= link_to "Download save file", rails_blob_path(checkpoint.save_file, disposition: "attachment") %>
          <% else %>
            <span>(No save file attached.)</span>
          <% end %>
        </div>
      </div>
    <% end %>
  </div>
</div>