summaryrefslogtreecommitdiff
path: root/app/views/tournaments
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/tournaments')
-rw-r--r--app/views/tournaments/_form.html.erb21
-rw-r--r--app/views/tournaments/edit.html.erb6
-rw-r--r--app/views/tournaments/index.json.jbuilder4
-rw-r--r--app/views/tournaments/new.html.erb1
-rw-r--r--app/views/tournaments/show.html.erb9
-rw-r--r--app/views/tournaments/show.json.jbuilder1
6 files changed, 41 insertions, 1 deletions
diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb
new file mode 100644
index 0000000..1fd63e9
--- /dev/null
+++ b/app/views/tournaments/_form.html.erb
@@ -0,0 +1,21 @@
+<%= form_for(@tournament) do |f| %>
+ <% if @tournament.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@tournament.errors.count, "error") %> prohibited this tournament from being saved:</h2>
+
+ <ul>
+ <% @tournament.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :game_id %><br>
+ <%= f.text_field :game_id %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
diff --git a/app/views/tournaments/edit.html.erb b/app/views/tournaments/edit.html.erb
new file mode 100644
index 0000000..2913025
--- /dev/null
+++ b/app/views/tournaments/edit.html.erb
@@ -0,0 +1,6 @@
+<h1>Editing tournament</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @tournament %> |
+<%= link_to 'Back', tournaments_path %>
diff --git a/app/views/tournaments/index.json.jbuilder b/app/views/tournaments/index.json.jbuilder
new file mode 100644
index 0000000..e6f3b49
--- /dev/null
+++ b/app/views/tournaments/index.json.jbuilder
@@ -0,0 +1,4 @@
+json.array!(@tournaments) do |tournament|
+ json.extract! tournament, :id, :game_id
+ json.url tournament_url(tournament, format: :json)
+end
diff --git a/app/views/tournaments/new.html.erb b/app/views/tournaments/new.html.erb
index a47f643..f1dec90 100644
--- a/app/views/tournaments/new.html.erb
+++ b/app/views/tournaments/new.html.erb
@@ -8,5 +8,4 @@
</div>
<br /><br />
-
<%= link_to 'Back', tournaments_path %>
diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb
new file mode 100644
index 0000000..30df788
--- /dev/null
+++ b/app/views/tournaments/show.html.erb
@@ -0,0 +1,9 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <strong>Game:</strong>
+ <%= @tournament.game %>
+</p>
+
+<%= link_to 'Edit', edit_tournament_path(@tournament) %> |
+<%= link_to 'Back', tournaments_path %>
diff --git a/app/views/tournaments/show.json.jbuilder b/app/views/tournaments/show.json.jbuilder
new file mode 100644
index 0000000..0fe65a6
--- /dev/null
+++ b/app/views/tournaments/show.json.jbuilder
@@ -0,0 +1 @@
+json.extract! @tournament, :id, :game_id, :created_at, :updated_at