summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorDavid Gay <eapoems@riseup.net>2023-10-30 02:00:16 -0400
committerDavid Gay <eapoems@riseup.net>2023-10-30 02:03:52 -0400
commit13df3e5aadae04b322bff4cb0279b299e2c92a41 (patch)
treeb5d586ac7ce2d0e748012cc3bb16ec18976a302c /app/views
parent818a106338b6924024809698915b1114bbc202d7 (diff)
Start and view runs
Diffstat (limited to 'app/views')
-rw-r--r--app/views/layouts/application.html.erb2
-rw-r--r--app/views/runs/new.html.erb31
-rw-r--r--app/views/runs/show.html.erb4
3 files changed, 36 insertions, 1 deletions
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index abe5895..46b1f5b 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -12,7 +12,7 @@
</head>
<body>
- <main class="container mx-auto mt-28 px-5 flex">
+ <main class="container mx-auto mt-28 px-5">
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
diff --git a/app/views/runs/new.html.erb b/app/views/runs/new.html.erb
new file mode 100644
index 0000000..e8b7b6e
--- /dev/null
+++ b/app/views/runs/new.html.erb
@@ -0,0 +1,31 @@
+<%= form_with model: @run do |f| %>
+ <div>
+ <%= f.label :game_id, "Game" %>
+ <%= f.collection_select :game_id, Game.all, :id, :title, {prompt: "Choose..."} %>
+ </div>
+
+ <div>
+ <%= f.label :title %>
+ <%= f.text_field :title %>
+ </div>
+
+ <div>
+ <%= f.label :description %>
+ <%= f.text_area :description %>
+ </div>
+
+ <div>
+ <%= f.submit "Start run" %>
+ </div>
+
+ <% if @run.errors.any? %>
+ <div>
+ <p><%= pluralize(@run.errors.count, "error") %> prohibited this run from being saved:</p>
+ <ul>
+ <% @run.errors.full_messages.each do |message| %>
+ <li><%= message %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+<% end %>
diff --git a/app/views/runs/show.html.erb b/app/views/runs/show.html.erb
new file mode 100644
index 0000000..adb41e4
--- /dev/null
+++ b/app/views/runs/show.html.erb
@@ -0,0 +1,4 @@
+<h1 class="text-2xl"><%= @run.title %></h1>
+<p class="subtitle"><%= @run.game.title %></p>
+
+<p>Run started by: <%= @run.user.email %></p>