Browse Source

improve ui for bike display & edit pages

vagrant
loos 11 years ago
parent
commit
4f83b879cc
  1. 23
      app/views/bikes/_fields.html.erb
  2. 8
      app/views/bikes/_form.html.erb
  3. 10
      app/views/bikes/edit.html.erb
  4. 15
      app/views/bikes/index.html.erb
  5. 12
      app/views/bikes/show.html.erb

23
app/views/bikes/_fields.html.erb

@ -2,29 +2,28 @@
<div class="form-group"> <div class="form-group">
<%= f.label "Bike Entry Date:", class: "col-sm-2 control-label" %> <%= f.label "Bike Entry Date:", class: "col-sm-2 control-label" %>
<div class="col-sm-6"> <div class="col-sm-10">
<%= f.text_field :entry_date, class: "form-control datepicker", disabled: disabled %> <%= f.text_field :entry_date, class: "form-control", disabled: disabled %>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<%= f.label "Brand:", class: "col-sm-2 control-label" %> <%= f.label "Brand:", class: "col-sm-2 control-label" %>
<div class="col-sm-6"> <div class="col-sm-10">
<%= f.text_field :brand, class: "form-control", disabled: disabled %> <%= f.text_field :brand, class: "form-control", disabled: disabled %>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<%= f.label "Model:", class: "col-sm-2 control-label" %> <%= f.label "Model:", class: "col-sm-2 control-label" %>
<div class="col-sm-10">
<div class="col-sm-6">
<%= f.text_field :model, class: "form-control", disabled: disabled %> <%= f.text_field :model, class: "form-control", disabled: disabled %>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<%= f.label "Type:", class: "col-sm-2 control-label" %> <%= f.label "Type:", class: "col-sm-2 control-label" %>
<div class="col-sm-6"> <div class="col-sm-10">
<%= f.text_field :bike_type, class: "form-control", disabled: disabled %> <%= f.text_field :bike_type, class: "form-control", disabled: disabled %>
</div> </div>
</div> </div>
@ -41,42 +40,42 @@
<div class="form-group"> <div class="form-group">
<%= f.label "Serial Number", class: "col-sm-2 control-label" %> <%= f.label "Serial Number", class: "col-sm-2 control-label" %>
<div class="col-sm-6"> <div class="col-sm-10">
<%= f.text_field :serial_number, class: "form-control", disabled: disabled %> <%= f.text_field :serial_number, class: "form-control", disabled: disabled %>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<%= f.label "Notes", class: "col-sm-2 control-label" %> <%= f.label "Notes", class: "col-sm-2 control-label" %>
<div class="col-sm-6"> <div class="col-sm-10">
<%= f.text_area :notes, class: "form-control", disabled: disabled %> <%= f.text_area :notes, class: "form-control", disabled: disabled %>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<%= f.label "Tag Info", class: "col-sm-2 control-label" %> <%= f.label "Tag Info", class: "col-sm-2 control-label" %>
<div class="col-sm-6"> <div class="col-sm-10">
<%= f.text_area :tag_info, class: "form-control", disabled: disabled %> <%= f.text_area :tag_info, class: "form-control", disabled: disabled %>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<%= f.label "Repaired by:", class: "col-sm-2 control-label" %> <%= f.label "Repaired by:", class: "col-sm-2 control-label" %>
<div class="col-sm-6"> <div class="col-sm-10">
<%= f.text_field :repaired_by, class: "form-control", disabled: disabled %> <%= f.text_field :repaired_by, class: "form-control", disabled: disabled %>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<%= f.label "Completion Date:", class: "col-sm-2 control-label" %> <%= f.label "Completion Date:", class: "col-sm-2 control-label" %>
<div class="col-sm-6"> <div class="col-sm-10">
<%= f.text_field :completion_date, class: "form-control datepicker", disabled: disabled %> <%= f.text_field :completion_date, class: "form-control datepicker", disabled: disabled %>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<%= f.label "Price", class: "col-sm-2 control-label" %> <%= f.label "Price", class: "col-sm-2 control-label" %>
<div class="col-sm-6"> <div class="col-sm-10">
<%= f.text_field :price, class: "form-control", disabled: disabled %> <%= f.text_field :price, class: "form-control", disabled: disabled %>
</div> </div>
</div> </div>

8
app/views/bikes/_form.html.erb

@ -1,4 +1,5 @@
<%= form_for @bike, html: {class: 'form-horizontal'} do |f| %> <div class="container">
<%= form_for @bike, html: {class: 'form-horizontal'} do |f| %>
<% if @bike.errors.any? %> <% if @bike.errors.any? %>
<div id="error_explanation"> <div id="error_explanation">
<h2><%= pluralize(@bike.errors.count, "error") %> prohibited this bike from being saved:</h2> <h2><%= pluralize(@bike.errors.count, "error") %> prohibited this bike from being saved:</h2>
@ -13,7 +14,10 @@
<%= render 'fields', f: f %> <%= render 'fields', f: f %>
<div class="row">
<div class="actions col-sm-offset-2"> <div class="actions col-sm-offset-2">
<%= f.submit class: "btn btn-default" %> <%= f.submit class: "btn btn-default" %>
</div> </div>
<% end %> </div>
<% end %>
</div>

10
app/views/bikes/edit.html.erb

@ -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 'Show', @bike %> |
<%= link_to 'Back', bikes_path %> <%= link_to 'Back', bikes_path %>
</div>

15
app/views/bikes/index.html.erb

@ -1,6 +1,8 @@
<h1>Listing bikes</h1> <div class="container">
<table class="table table-striped table-bordered table-hover"> <h1>Listing bikes</h1>
<table class="table table-striped table-bordered table-hover">
<thead> <thead>
<tr> <tr>
<th> Brand </th> <th> Brand </th>
@ -10,7 +12,6 @@
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @bikes.each do |bike| %> <% @bikes.each do |bike| %>
<tr> <tr>
@ -22,8 +23,8 @@
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<br>
<%= link_to ' + Log Bike', new_bike_path %> <br>
<%= link_to ' + Log Bike', new_bike_path, class: "btn btn-default" %>
</div>

12
app/views/bikes/show.html.erb

@ -1,7 +1,9 @@
<p id="notice"><%= notice %></p> <div class="container">
<%= form_for(@bike) do |f| %> <p id="notice"><%= notice %></p>
<%= form_for(@bike) do |f| %>
<%= render 'fields', f: f, disabled: true %> <%= render 'fields', f: f, disabled: true %>
<% end %> <% end %>
<%= link_to 'Edit', edit_bike_path(@bike) %> | <%= link_to 'Edit', edit_bike_path(@bike) %> |
<%= link_to 'Back', bikes_path %> <%= link_to 'Back', bikes_path %>
</div>

Loading…
Cancel
Save