summaryrefslogtreecommitdiff
path: root/app/views/checkpoints/new.html.erb
blob: 712eae182c2d10c814e53b3b5395308dfd655a46 (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
51
52
53
54
55
<div class="space-y-4">
  <h1 class="text-xl"><%= @run.title %></h1>

  <p class="subtitle">New checkpoint</p>

  <%= form_with model: [@run, @checkpoint], class: "space-y-4" do |f| %>
    <div>
      <%= f.label :title %>
      <%= f.text_field :title %>
    </div>

    <div>
      <%= f.label :description %>
      <%= f.text_area :description %>
    </div>

    <div>
      <%= f.label :save_file %>
      <%= f.file_field :save_file %>
    </div>

    <div>
      <div>
        <%= f.radio_button :kind, "comment" %>
        <%= f.label :kind_comment, "I'm just leaving a comment" %>
      </div>
      <% if @run.checked_in? %>
        <div>
          <%= f.radio_button :kind, "checkout" %>
          <%= f.label :kind_checkout, "I'm checking out this save file, lock the run until I check it back in" %>
        </div>
      <% else %>
        <div>
          <%= f.radio_button :kind, "checkin" %>
          <%= f.label :kind_checkin, "I'm checking in this save file so another trainer can play it" %>
        </div>
      <% end %>
    </div>

    <div>
      <%= f.submit "Save checkpoint", class: "btn-primary" %>
    </div>

    <% if @checkpoint.errors.any? %>
      <div>
        <p><%= pluralize(@checkpoint.errors.count, "error") %> prohibited this checkpoint from being saved:</p>
        <ul>
          <% @checkpoint.errors.full_messages.each do |message| %>
            <li><%= message %></li>
          <% end %>
        </ul>
      </div>
    <% end %>
  <% end %>
</div>