diff options
author | David Gay <david@davidgay.org> | 2023-11-02 19:05:13 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2023-11-02 19:05:13 -0400 |
commit | bb4eb1113b188ad7f1149df715ae2d9fd0411ca7 (patch) | |
tree | 2fabac7be53fd90a973da1707d9a785eab7dcdcb /app/views | |
parent | 11b7be5c41edda171a05e92295c51320cb315c68 (diff) |
Improve run and checkpoint views
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/checkpoints/new.html.erb | 12 | ||||
-rw-r--r-- | app/views/runs/show.html.erb | 39 |
2 files changed, 35 insertions, 16 deletions
diff --git a/app/views/checkpoints/new.html.erb b/app/views/checkpoints/new.html.erb index b11a9bc..dad7e82 100644 --- a/app/views/checkpoints/new.html.erb +++ b/app/views/checkpoints/new.html.erb @@ -9,10 +9,12 @@ <%= f.text_area :comment %> </div> - <div> - <div><%= f.label :save_file %></div> - <%= f.file_field :save_file %> - </div> + <% unless @run.checked_in? %> + <div> + <div><%= f.label :save_file %></div> + <%= f.file_field :save_file %> + </div> + <% end %> <div> <div> @@ -24,7 +26,7 @@ <%= 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 %> + <% elsif @run.checked_out_user == current_user %> <div> <%= f.radio_button :kind, "checkin" %> <%= f.label :kind_checkin, "I'm checking in this save file so another trainer can play it" %> diff --git a/app/views/runs/show.html.erb b/app/views/runs/show.html.erb index 55bef02..e080783 100644 --- a/app/views/runs/show.html.erb +++ b/app/views/runs/show.html.erb @@ -9,7 +9,8 @@ <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) %>. + checked in! You can <%= link_to "checkout this run", new_run_checkpoint_path(@run) %> + to play it yourself, then check it back in when you're done to save your progress. <% else %> checked out by <%= link_to @run.checked_out_user.name || "???", user_path(@run.checked_out_user) %>. <% if @run.last_save_file.attached? %> @@ -21,25 +22,41 @@ </div> <h2 class="text-xl">Checkpoints</h2> - <%= link_to "New checkpoint", new_run_checkpoint_path(@run) %> + <div><%= link_to "New checkpoint", new_run_checkpoint_path(@run) %></div> <% @run.checkpoints.order(:created_at).reverse.each do |checkpoint| %> <div class="border-l border-orange-900 p-2"> <div class="flex flex-col"> + <div class="flex space-x-2 text-sm"> + <div> + <% case checkpoint.kind.to_sym %> + <% when :comment %> + 💬 + <% when :checkin %> + 📬 + <% when :checkout %> + 📠+ <% else %> + <%# Should never happen. %> + <% end %> + </div> + <div class="flex space-x-2"> + <span class="uppercase"><%= checkpoint.kind %></span> + <% if checkpoint.save_file.attached? %> + <%= link_to "Download save file", rails_blob_path(checkpoint.save_file, disposition: "attachment") %> + <% end %> + </div> + + </div> <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 %> + <%= time_ago_in_words(checkpoint.created_at) %> ago by + <%= link_to checkpoint.user.name || "???", user_path(checkpoint.user) %> + <span>@ <%= checkpoint.created_at %></span> </div> <% if checkpoint.comment %> - <div><%= checkpoint.comment %></div> + <div class="text-lg"><%= checkpoint.comment %></div> <% end %> </div> </div> |