diff options
Diffstat (limited to 'app/views/matches')
-rw-r--r-- | app/views/matches/_form.html.erb | 21 | ||||
-rw-r--r-- | app/views/matches/edit.html.erb | 6 | ||||
-rw-r--r-- | app/views/matches/index.html.erb | 27 | ||||
-rw-r--r-- | app/views/matches/index.json.jbuilder | 4 | ||||
-rw-r--r-- | app/views/matches/new.html.erb | 5 | ||||
-rw-r--r-- | app/views/matches/show.html.erb | 9 | ||||
-rw-r--r-- | app/views/matches/show.json.jbuilder | 1 |
7 files changed, 73 insertions, 0 deletions
diff --git a/app/views/matches/_form.html.erb b/app/views/matches/_form.html.erb new file mode 100644 index 0000000..34494c3 --- /dev/null +++ b/app/views/matches/_form.html.erb @@ -0,0 +1,21 @@ +<%= form_for(@match) do |f| %> + <% if @match.errors.any? %> + <div id="error_explanation"> + <h2><%= pluralize(@match.errors.count, "error") %> prohibited this match from being saved:</h2> + + <ul> + <% @match.errors.full_messages.each do |msg| %> + <li><%= msg %></li> + <% end %> + </ul> + </div> + <% end %> + + <div class="field"> + <%= f.label :tournament_id %><br> + <%= f.text_field :tournament_id %> + </div> + <div class="actions"> + <%= f.submit %> + </div> +<% end %> diff --git a/app/views/matches/edit.html.erb b/app/views/matches/edit.html.erb new file mode 100644 index 0000000..38b7d70 --- /dev/null +++ b/app/views/matches/edit.html.erb @@ -0,0 +1,6 @@ +<h1>Editing match</h1> + +<%= render 'form' %> + +<%= link_to 'Show', @match %> | +<%= link_to 'Back', matches_path %> diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb new file mode 100644 index 0000000..d8122ac --- /dev/null +++ b/app/views/matches/index.html.erb @@ -0,0 +1,27 @@ +<h1>Listing matches</h1> + +<table> + <thead> + <tr> + <th>Tournament</th> + <th></th> + <th></th> + <th></th> + </tr> + </thead> + + <tbody> + <% @matches.each do |match| %> + <tr> + <td><%= match.tournament %></td> + <td><%= link_to 'Show', match %></td> + <td><%= link_to 'Edit', edit_match_path(match) %></td> + <td><%= link_to 'Destroy', match, method: :delete, data: { confirm: 'Are you sure?' } %></td> + </tr> + <% end %> + </tbody> +</table> + +<br> + +<%= link_to 'New Match', new_match_path %> diff --git a/app/views/matches/index.json.jbuilder b/app/views/matches/index.json.jbuilder new file mode 100644 index 0000000..c8ada7a --- /dev/null +++ b/app/views/matches/index.json.jbuilder @@ -0,0 +1,4 @@ +json.array!(@matches) do |match| + json.extract! match, :id, :tournament_id + json.url match_url(match, format: :json) +end diff --git a/app/views/matches/new.html.erb b/app/views/matches/new.html.erb new file mode 100644 index 0000000..bd4c78c --- /dev/null +++ b/app/views/matches/new.html.erb @@ -0,0 +1,5 @@ +<h1>New match</h1> + +<%= render 'form' %> + +<%= link_to 'Back', matches_path %> diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb new file mode 100644 index 0000000..7bab721 --- /dev/null +++ b/app/views/matches/show.html.erb @@ -0,0 +1,9 @@ +<p id="notice"><%= notice %></p> + +<p> + <strong>Tournament:</strong> + <%= @match.tournament %> +</p> + +<%= link_to 'Edit', edit_match_path(@match) %> | +<%= link_to 'Back', matches_path %> diff --git a/app/views/matches/show.json.jbuilder b/app/views/matches/show.json.jbuilder new file mode 100644 index 0000000..2e45395 --- /dev/null +++ b/app/views/matches/show.json.jbuilder @@ -0,0 +1 @@ +json.extract! @match, :id, :tournament_id, :created_at, :updated_at |