initial commit
This commit is contained in:
25
app/views/results/_form.html.erb
Normal file
25
app/views/results/_form.html.erb
Normal file
@@ -0,0 +1,25 @@
|
||||
<%= form_for(@result) do |f| %>
|
||||
<% if @result.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@result.errors.count, "error") %> prohibited this result from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @result.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :user_id %><br>
|
||||
<%= f.number_field :user_id %>
|
||||
</div>
|
||||
<div class="field">
|
||||
<%= f.label :time %><br>
|
||||
<%= f.text_field :time %>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
6
app/views/results/edit.html.erb
Normal file
6
app/views/results/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing result</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @result %> |
|
||||
<%= link_to 'Back', results_path %>
|
||||
29
app/views/results/index.html.erb
Normal file
29
app/views/results/index.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<h1>Listing results</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>User</th>
|
||||
<th>Time</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @results.each do |result| %>
|
||||
<tr>
|
||||
<td><%= result.user_id %></td>
|
||||
<td><%= result.time %></td>
|
||||
<td><%= link_to 'Show', result %></td>
|
||||
<td><%= link_to 'Edit', edit_result_path(result) %></td>
|
||||
<td><%= link_to 'Destroy', result, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<%= link_to 'New Result', new_result_path %>
|
||||
4
app/views/results/index.json.jbuilder
Normal file
4
app/views/results/index.json.jbuilder
Normal file
@@ -0,0 +1,4 @@
|
||||
json.array!(@results) do |result|
|
||||
json.extract! result, :user_id, :time
|
||||
json.url result_url(result, format: :json)
|
||||
end
|
||||
5
app/views/results/new.html.erb
Normal file
5
app/views/results/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>New result</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', results_path %>
|
||||
14
app/views/results/show.html.erb
Normal file
14
app/views/results/show.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<strong>User:</strong>
|
||||
<%= @result.user_id %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Time:</strong>
|
||||
<%= @result.time %>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Edit', edit_result_path(@result) %> |
|
||||
<%= link_to 'Back', results_path %>
|
||||
1
app/views/results/show.json.jbuilder
Normal file
1
app/views/results/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.extract! @result, :user_id, :time, :created_at, :updated_at
|
||||
Reference in New Issue
Block a user