Add & Display Flights
This commit is contained in:
9
app/views/flights/index.html.erb
Normal file
9
app/views/flights/index.html.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
<h1>Flights</h1>
|
||||
|
||||
<ul>
|
||||
<% @flights.each do |flight| %>
|
||||
<li>
|
||||
<%= link_to flight.title, flight %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
47
app/views/flights/new.html.erb
Normal file
47
app/views/flights/new.html.erb
Normal file
@@ -0,0 +1,47 @@
|
||||
<h1>New Flight</h1>
|
||||
|
||||
<%= form_with model: @flight do |form| %>
|
||||
<div>
|
||||
<%= form.label :aircraft %><br>
|
||||
<%= form.select :aircraft, @aircraft %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :date %><br>
|
||||
<%= form.date_field :date %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :from %><br>
|
||||
<%= form.text_field :from %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :to %><br>
|
||||
<%= form.text_field :to %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :tach %><br>
|
||||
<%= form.number_field :tach %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :hobbs %><br>
|
||||
<%= form.number_field :hobbs %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :fuel %><br>
|
||||
<%= form.check_box :fuel %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :oil %><br>
|
||||
<%= form.check_box :oil %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
10
app/views/flights/show.html.erb
Normal file
10
app/views/flights/show.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<h1><%= @flight.date %></h1>
|
||||
|
||||
<h3><%= @flight.aircraft.reg %></h3>
|
||||
<p> <b>From:</b> <%= @flight.from %></p>
|
||||
<p> <b>To:</b> <%= @flight.to %></p>
|
||||
<p> <b>Tach:</b> <%= @flight.tach %></p>
|
||||
<p> <b>Hobbs:</b> <%= @flight.hobbs %></p>
|
||||
<p> <b>Fuel Added:</b> <%= @flight.fuel %></p>
|
||||
<p> <b>Oil Added:</b> <%= @flight.oil %></p>
|
||||
<p> <b>Total Flight Time:</b> <%= @flight.time %></p>
|
||||
Reference in New Issue
Block a user