From 4f83b879cc08bb661265b625a42ae5bd882eebfa Mon Sep 17 00:00:00 2001 From: loos Date: Mon, 3 Mar 2014 09:26:20 -0600 Subject: [PATCH] improve ui for bike display & edit pages --- app/views/bikes/_fields.html.erb | 27 ++++++++--------- app/views/bikes/_form.html.erb | 38 +++++++++++++----------- app/views/bikes/edit.html.erb | 14 +++++---- app/views/bikes/index.html.erb | 51 ++++++++++++++++---------------- app/views/bikes/show.html.erb | 16 +++++----- 5 files changed, 77 insertions(+), 69 deletions(-) diff --git a/app/views/bikes/_fields.html.erb b/app/views/bikes/_fields.html.erb index 00af6c8..7c5ede5 100644 --- a/app/views/bikes/_fields.html.erb +++ b/app/views/bikes/_fields.html.erb @@ -2,81 +2,80 @@
<%= f.label "Bike Entry Date:", class: "col-sm-2 control-label" %> -
- <%= f.text_field :entry_date, class: "form-control datepicker", disabled: disabled %> +
+ <%= f.text_field :entry_date, class: "form-control", disabled: disabled %>
<%= f.label "Brand:", class: "col-sm-2 control-label" %> -
+
<%= f.text_field :brand, class: "form-control", disabled: disabled %>
<%= f.label "Model:", class: "col-sm-2 control-label" %> - -
+
<%= f.text_field :model, class: "form-control", disabled: disabled %>
<%= f.label "Type:", class: "col-sm-2 control-label" %> -
+
<%= f.text_field :bike_type, class: "form-control", disabled: disabled %>
<%= f.label "Freecyclery?", class: "col-sm-offset-2 control-label" %> - <%= f.check_box :freecyclery, disabled: disabled %> + <%= f.check_box :freecyclery, disabled: disabled %>
<%= f.label "Sale?", class: "col-sm-offset-2 control-label" %> - <%= f.check_box :sale, disabled: disabled %> + <%= f.check_box :sale, disabled: disabled %>
<%= f.label "Serial Number", class: "col-sm-2 control-label" %> -
+
<%= f.text_field :serial_number, class: "form-control", disabled: disabled %>
<%= f.label "Notes", class: "col-sm-2 control-label" %> -
+
<%= f.text_area :notes, class: "form-control", disabled: disabled %>
<%= f.label "Tag Info", class: "col-sm-2 control-label" %> -
+
<%= f.text_area :tag_info, class: "form-control", disabled: disabled %>
<%= f.label "Repaired by:", class: "col-sm-2 control-label" %> -
+
<%= f.text_field :repaired_by, class: "form-control", disabled: disabled %>
<%= f.label "Completion Date:", class: "col-sm-2 control-label" %> -
+
<%= f.text_field :completion_date, class: "form-control datepicker", disabled: disabled %>
<%= f.label "Price", class: "col-sm-2 control-label" %> -
+
<%= f.text_field :price, class: "form-control", disabled: disabled %>
diff --git a/app/views/bikes/_form.html.erb b/app/views/bikes/_form.html.erb index 768dce1..528c06c 100644 --- a/app/views/bikes/_form.html.erb +++ b/app/views/bikes/_form.html.erb @@ -1,19 +1,23 @@ -<%= form_for @bike, html: {class: 'form-horizontal'} do |f| %> - <% if @bike.errors.any? %> -
-

<%= pluralize(@bike.errors.count, "error") %> prohibited this bike from being saved:

- -
    - <% @bike.errors.full_messages.each do |msg| %> -
  • <%= msg %>
  • - <% end %> -
+
+ <%= form_for @bike, html: {class: 'form-horizontal'} do |f| %> + <% if @bike.errors.any? %> +
+

<%= pluralize(@bike.errors.count, "error") %> prohibited this bike from being saved:

+ +
    + <% @bike.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + + <%= render 'fields', f: f %> + +
+
+ <%= f.submit class: "btn btn-default" %> +
<% end %> - - <%= render 'fields', f: f %> - -
- <%= f.submit class: "btn btn-default" %> -
-<% end %> +
diff --git a/app/views/bikes/edit.html.erb b/app/views/bikes/edit.html.erb index 3d9c87e..c22f2f7 100644 --- a/app/views/bikes/edit.html.erb +++ b/app/views/bikes/edit.html.erb @@ -1,6 +1,8 @@ -

Editing bike

- -<%= render 'form' %> - -<%= link_to 'Show', @bike %> | -<%= link_to 'Back', bikes_path %> +
+

Editing bike

+ + <%= render 'form' %> + + <%= link_to 'Show', @bike %> | + <%= link_to 'Back', bikes_path %> +
diff --git a/app/views/bikes/index.html.erb b/app/views/bikes/index.html.erb index 0c321fe..439f151 100644 --- a/app/views/bikes/index.html.erb +++ b/app/views/bikes/index.html.erb @@ -1,29 +1,30 @@ -

Listing bikes

+
- - - - - - - - - - +

Listing bikes

- - <% @bikes.each do |bike| %> +
Brand Model
+ - - - - - + + + + + - <% end %> - -
<%= bike.brand %><%= bike.model %><%= link_to 'Show', bike %><%= link_to 'Edit', edit_bike_path(bike) %><%= link_to 'Destroy', bike, method: :delete, data: { confirm: 'Are you sure?' } %> Brand Model
- -
- -<%= link_to ' + Log Bike', new_bike_path %> + + + <% @bikes.each do |bike| %> + + <%= bike.brand %> + <%= bike.model %> + <%= link_to 'Show', bike %> + <%= link_to 'Edit', edit_bike_path(bike) %> + <%= link_to 'Destroy', bike, method: :delete, data: { confirm: 'Are you sure?' } %> + + <% end %> + + + +
+ <%= link_to ' + Log Bike', new_bike_path, class: "btn btn-default" %> +
diff --git a/app/views/bikes/show.html.erb b/app/views/bikes/show.html.erb index 34d0baa..1a25cf6 100644 --- a/app/views/bikes/show.html.erb +++ b/app/views/bikes/show.html.erb @@ -1,7 +1,9 @@ -

<%= notice %>

-<%= form_for(@bike) do |f| %> - <%= render 'fields', f: f, disabled: true %> -<% end %> - -<%= link_to 'Edit', edit_bike_path(@bike) %> | -<%= link_to 'Back', bikes_path %> +
+

<%= notice %>

+ <%= form_for(@bike) do |f| %> + <%= render 'fields', f: f, disabled: true %> + <% end %> + + <%= link_to 'Edit', edit_bike_path(@bike) %> | + <%= link_to 'Back', bikes_path %> +