summaryrefslogtreecommitdiff
path: root/app/views/games
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-02-27 16:59:04 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-02-27 16:59:04 -0500
commit3a7b14f4a51c0fdb8b71720f361a0a8ccf080325 (patch)
treeb677c4e56d96dfc872ae58d0d0e45d8243750441 /app/views/games
parent8e3e88f52c1f2d73acdcb7fdf60326b5f7717068 (diff)
add game types
Diffstat (limited to 'app/views/games')
-rw-r--r--app/views/games/_form.html.erb21
-rw-r--r--app/views/games/edit.html.erb6
-rw-r--r--app/views/games/index.html.erb27
-rw-r--r--app/views/games/index.json.jbuilder4
-rw-r--r--app/views/games/new.html.erb5
-rw-r--r--app/views/games/show.html.erb9
-rw-r--r--app/views/games/show.json.jbuilder1
7 files changed, 73 insertions, 0 deletions
diff --git a/app/views/games/_form.html.erb b/app/views/games/_form.html.erb
new file mode 100644
index 0000000..0bbdd1f
--- /dev/null
+++ b/app/views/games/_form.html.erb
@@ -0,0 +1,21 @@
+<%= form_for(@game) do |f| %>
+ <% if @game.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@game.errors.count, "error") %> prohibited this game from being saved:</h2>
+
+ <ul>
+ <% @game.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :name %><br>
+ <%= f.text_area :name %>
+ </div>
+ <div class="actions">
+ <%= f.submit %>
+ </div>
+<% end %>
diff --git a/app/views/games/edit.html.erb b/app/views/games/edit.html.erb
new file mode 100644
index 0000000..d72bd2e
--- /dev/null
+++ b/app/views/games/edit.html.erb
@@ -0,0 +1,6 @@
+<h1>Editing game</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Show', @game %> |
+<%= link_to 'Back', games_path %>
diff --git a/app/views/games/index.html.erb b/app/views/games/index.html.erb
new file mode 100644
index 0000000..27d47b6
--- /dev/null
+++ b/app/views/games/index.html.erb
@@ -0,0 +1,27 @@
+<h1>Listing games</h1>
+
+<table>
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th></th>
+ <th></th>
+ <th></th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <% @games.each do |game| %>
+ <tr>
+ <td><%= game.name %></td>
+ <td><%= link_to 'Show', game %></td>
+ <td><%= link_to 'Edit', edit_game_path(game) %></td>
+ <td><%= link_to 'Destroy', game, method: :delete, data: { confirm: 'Are you sure?' } %></td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
+
+<br>
+
+<%= link_to 'New Game', new_game_path %>
diff --git a/app/views/games/index.json.jbuilder b/app/views/games/index.json.jbuilder
new file mode 100644
index 0000000..90f4236
--- /dev/null
+++ b/app/views/games/index.json.jbuilder
@@ -0,0 +1,4 @@
+json.array!(@games) do |game|
+ json.extract! game, :id, :name
+ json.url game_url(game, format: :json)
+end
diff --git a/app/views/games/new.html.erb b/app/views/games/new.html.erb
new file mode 100644
index 0000000..ab95f70
--- /dev/null
+++ b/app/views/games/new.html.erb
@@ -0,0 +1,5 @@
+<h1>New game</h1>
+
+<%= render 'form' %>
+
+<%= link_to 'Back', games_path %>
diff --git a/app/views/games/show.html.erb b/app/views/games/show.html.erb
new file mode 100644
index 0000000..20d374f
--- /dev/null
+++ b/app/views/games/show.html.erb
@@ -0,0 +1,9 @@
+<p id="notice"><%= notice %></p>
+
+<p>
+ <strong>Name:</strong>
+ <%= @game.name %>
+</p>
+
+<%= link_to 'Edit', edit_game_path(@game) %> |
+<%= link_to 'Back', games_path %>
diff --git a/app/views/games/show.json.jbuilder b/app/views/games/show.json.jbuilder
new file mode 100644
index 0000000..a4d8d1c
--- /dev/null
+++ b/app/views/games/show.json.jbuilder
@@ -0,0 +1 @@
+json.extract! @game, :id, :name, :created_at, :updated_at