loos
11 years ago
5 changed files with 77 additions and 69 deletions
@ -1,19 +1,23 @@ |
|||||
<%= form_for @bike, html: {class: 'form-horizontal'} do |f| %> |
<div class="container"> |
||||
<% if @bike.errors.any? %> |
<%= form_for @bike, html: {class: 'form-horizontal'} do |f| %> |
||||
<div id="error_explanation"> |
<% if @bike.errors.any? %> |
||||
<h2><%= pluralize(@bike.errors.count, "error") %> prohibited this bike from being saved:</h2> |
<div id="error_explanation"> |
||||
|
<h2><%= pluralize(@bike.errors.count, "error") %> prohibited this bike from being saved:</h2> |
||||
<ul> |
|
||||
<% @bike.errors.full_messages.each do |msg| %> |
<ul> |
||||
<li><%= msg %></li> |
<% @bike.errors.full_messages.each do |msg| %> |
||||
<% end %> |
<li><%= msg %></li> |
||||
</ul> |
<% end %> |
||||
|
</ul> |
||||
|
</div> |
||||
|
<% end %> |
||||
|
|
||||
|
<%= render 'fields', f: f %> |
||||
|
|
||||
|
<div class="row"> |
||||
|
<div class="actions col-sm-offset-2"> |
||||
|
<%= f.submit class: "btn btn-default" %> |
||||
|
</div> |
||||
</div> |
</div> |
||||
<% end %> |
<% end %> |
||||
|
</div> |
||||
<%= render 'fields', f: f %> |
|
||||
|
|
||||
<div class="actions col-sm-offset-2"> |
|
||||
<%= f.submit class: "btn btn-default" %> |
|
||||
</div> |
|
||||
<% end %> |
|
||||
|
@ -1,6 +1,8 @@ |
|||||
<h1>Editing bike</h1> |
<div class="container"> |
||||
|
<h1>Editing bike</h1> |
||||
<%= render 'form' %> |
|
||||
|
<%= render 'form' %> |
||||
<%= link_to 'Show', @bike %> | |
|
||||
<%= link_to 'Back', bikes_path %> |
<%= link_to 'Show', @bike %> | |
||||
|
<%= link_to 'Back', bikes_path %> |
||||
|
</div> |
||||
|
@ -1,29 +1,30 @@ |
|||||
<h1>Listing bikes</h1> |
<div class="container"> |
||||
|
|
||||
<table class="table table-striped table-bordered table-hover"> |
<h1>Listing bikes</h1> |
||||
<thead> |
|
||||
<tr> |
|
||||
<th> Brand </th> |
|
||||
<th> Model </th> |
|
||||
<th></th> |
|
||||
<th></th> |
|
||||
<th></th> |
|
||||
</tr> |
|
||||
</thead> |
|
||||
|
|
||||
<tbody> |
<table class="table table-striped table-bordered table-hover"> |
||||
<% @bikes.each do |bike| %> |
<thead> |
||||
<tr> |
<tr> |
||||
<td><%= bike.brand %></td> |
<th> Brand </th> |
||||
<td><%= bike.model %></td> |
<th> Model </th> |
||||
<td><%= link_to 'Show', bike %></td> |
<th></th> |
||||
<td><%= link_to 'Edit', edit_bike_path(bike) %></td> |
<th></th> |
||||
<td><%= link_to 'Destroy', bike, method: :delete, data: { confirm: 'Are you sure?' } %></td> |
<th></th> |
||||
</tr> |
</tr> |
||||
<% end %> |
</thead> |
||||
</tbody> |
<tbody> |
||||
</table> |
<% @bikes.each do |bike| %> |
||||
|
<tr> |
||||
<br> |
<td><%= bike.brand %></td> |
||||
|
<td><%= bike.model %></td> |
||||
<%= link_to ' + Log Bike', new_bike_path %> |
<td><%= link_to 'Show', bike %></td> |
||||
|
<td><%= link_to 'Edit', edit_bike_path(bike) %></td> |
||||
|
<td><%= link_to 'Destroy', bike, method: :delete, data: { confirm: 'Are you sure?' } %></td> |
||||
|
</tr> |
||||
|
<% end %> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
|
||||
|
<br> |
||||
|
<%= link_to ' + Log Bike', new_bike_path, class: "btn btn-default" %> |
||||
|
</div> |
||||
|
@ -1,7 +1,9 @@ |
|||||
<p id="notice"><%= notice %></p> |
<div class="container"> |
||||
<%= form_for(@bike) do |f| %> |
<p id="notice"><%= notice %></p> |
||||
<%= render 'fields', f: f, disabled: true %> |
<%= form_for(@bike) do |f| %> |
||||
<% end %> |
<%= render 'fields', f: f, disabled: true %> |
||||
|
<% end %> |
||||
<%= link_to 'Edit', edit_bike_path(@bike) %> | |
|
||||
<%= link_to 'Back', bikes_path %> |
<%= link_to 'Edit', edit_bike_path(@bike) %> | |
||||
|
<%= link_to 'Back', bikes_path %> |
||||
|
</div> |
||||
|
Loading…
Reference in new issue