diff options
Diffstat (limited to 'app/views/tournaments')
-rw-r--r-- | app/views/tournaments/_form.html.erb | 17 | ||||
-rw-r--r-- | app/views/tournaments/edit.html.erb | 6 | ||||
-rw-r--r-- | app/views/tournaments/index.html.erb | 25 | ||||
-rw-r--r-- | app/views/tournaments/index.json.jbuilder | 4 | ||||
-rw-r--r-- | app/views/tournaments/new.html.erb | 5 | ||||
-rw-r--r-- | app/views/tournaments/show.html.erb | 4 | ||||
-rw-r--r-- | app/views/tournaments/show.json.jbuilder | 1 |
7 files changed, 62 insertions, 0 deletions
diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb new file mode 100644 index 0000000..8996266 --- /dev/null +++ b/app/views/tournaments/_form.html.erb @@ -0,0 +1,17 @@ +<%= 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="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.html.erb b/app/views/tournaments/index.html.erb new file mode 100644 index 0000000..7124111 --- /dev/null +++ b/app/views/tournaments/index.html.erb @@ -0,0 +1,25 @@ +<h1>Listing tournaments</h1> + +<table> + <thead> + <tr> + <th></th> + <th></th> + <th></th> + </tr> + </thead> + + <tbody> + <% @tournaments.each do |tournament| %> + <tr> + <td><%= link_to 'Show', tournament %></td> + <td><%= link_to 'Edit', edit_tournament_path(tournament) %></td> + <td><%= link_to 'Destroy', tournament, method: :delete, data: { confirm: 'Are you sure?' } %></td> + </tr> + <% end %> + </tbody> +</table> + +<br> + +<%= link_to 'New Tournament', new_tournament_path %> diff --git a/app/views/tournaments/index.json.jbuilder b/app/views/tournaments/index.json.jbuilder new file mode 100644 index 0000000..28d6960 --- /dev/null +++ b/app/views/tournaments/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@tournaments) do |tournament| + json.extract! tournament, :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 new file mode 100644 index 0000000..2a60539 --- /dev/null +++ b/app/views/tournaments/new.html.erb @@ -0,0 +1,5 @@ +<h1>New tournament</h1> + +<%= render 'form' %> + +<%= 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..2c280ba --- /dev/null +++ b/app/views/tournaments/show.html.erb @@ -0,0 +1,4 @@ +<p id="notice"><%= notice %></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..211799a --- /dev/null +++ b/app/views/tournaments/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @tournament, :id, :created_at, :updated_at |