diff --git a/Gemfile b/Gemfile index 5e242b2..7ee4b14 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,7 @@ gem 'bcrypt-ruby', '3.1.2' #SCSS & Bootstrap gem 'bootstrap-sass', '2.3.2.0' gem 'sass-rails', '~> 4.0.0' +gem 'haml' group :test, :development do gem 'rspec' diff --git a/Gemfile.lock b/Gemfile.lock index b715673..6635f55 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -61,6 +61,8 @@ GEM railties (>= 3.0.0) ffi (1.9.3) growl (1.0.3) + haml (4.0.5) + tilt hike (1.2.3) i18n (0.6.9) jbuilder (1.0.2) @@ -183,6 +185,7 @@ DEPENDENCIES factory_girl factory_girl_rails (~> 4.0) growl (= 1.0.3) + haml jbuilder (= 1.0.2) jquery-rails (= 3.0.4) jquery-turbolinks diff --git a/app/views/bikes/_fields.html.erb b/app/views/bikes/_fields.html.erb deleted file mode 100644 index ec64881..0000000 --- a/app/views/bikes/_fields.html.erb +++ /dev/null @@ -1,108 +0,0 @@ -<% disabled ||= false %> - -
- <%= f.label "Log Number", class: "col-sm-2 control-label" %> -
- <%= f.text_field :log_number, class: "form-control", disabled: disabled %> -
-
- -
- <%= f.label "Bike Entry Date:", class: "col-sm-2 control-label" %> -
- <%= 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 "Color:", class: "col-sm-2 control-label" %> -
- <%= f.text_field :color, class: "form-control", disabled: disabled %> -
-
- - -
- <%= f.label "Top Tube Size:", class: "col-sm-2 control-label" %> -
- <%= f.text_field :top_tube_size, class: "form-control", disabled: disabled %> -
-
- - -
- <%= f.label "Seat Tube Size:", class: "col-sm-2 control-label" %> -
- <%= f.text_field :seat_tube_size, 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 "Purpose:", class: "col-sm-2 control-label" %> -
- <%= f.select :purpose, [["Freecyclery", "Freecyclery"], ["Sale", "Sale"]], class: "selectpicker", 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 "Mechanic:", class: "col-sm-2 control-label" %> -
- <%= f.text_field :mechanic, 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/_fields.html.haml b/app/views/bikes/_fields.html.haml new file mode 100644 index 0000000..defac4d --- /dev/null +++ b/app/views/bikes/_fields.html.haml @@ -0,0 +1,76 @@ +- disabled ||= false +.form-horizontal + .form-group + = f.label "Log Number", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :log_number, class: "form-control", disabled: disabled + + .form-group + = f.label "Bike Entry Date:", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :entry_date, class: "form-control", disabled: disabled + + .form-group + = f.label "Brand:", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :brand, class: "form-control", disabled: disabled + + .form-group + = f.label "Color:", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :color, class: "form-control", disabled: disabled + + .form-group + = f.label "Top Tube Size:", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :top_tube_size, class: "form-control", disabled: disabled + + .form-group + = f.label "Seat Tube Size:", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :seat_tube_size, class: "form-control", disabled: disabled + + .form-group + = f.label "Model:", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :model, class: "form-control", disabled: disabled + + .form-group + = f.label "Type:", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :bike_type, class: "form-control", disabled: disabled + + .form-group + = f.label "Purpose:", class: "col-sm-2 control-label" + .col-sm-10 + = f.select :purpose, [["Freecyclery", "Freecyclery"], ["Sale", "Sale"]], class: "selectpicker", disabled: disabled + + .form-group + = f.label "Serial Number", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :serial_number, class: "form-control", disabled: disabled + + .form-group + = f.label "Notes", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_area :notes, class: "form-control", disabled: disabled + + .form-group + = f.label "Tag Info", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_area :tag_info, class: "form-control", disabled: disabled + + .form-group + = f.label "Mechanic:", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :mechanic, class: "form-control", disabled: disabled + + .form-group + = f.label "Completion Date:", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :completion_date, class: "form-control datepicker", disabled: disabled + + .form-group + = f.label "Price", class: "col-sm-2 control-label" + .col-sm-10 + = 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 deleted file mode 100644 index 528c06c..0000000 --- a/app/views/bikes/_form.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -
- <%= form_for @bike, html: {class: 'form-horizontal'} do |f| %> - <% if @bike.errors.any? %> -
-

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

- - -
- <% end %> - - <%= render 'fields', f: f %> - -
-
- <%= f.submit class: "btn btn-default" %> -
-
- <% end %> -
diff --git a/app/views/bikes/_form.html.haml b/app/views/bikes/_form.html.haml new file mode 100644 index 0000000..c105f17 --- /dev/null +++ b/app/views/bikes/_form.html.haml @@ -0,0 +1,12 @@ +.container + = form_for @bike, html: {class: 'form-horizontal'} do |f| + - if @bike.errors.any? + #error_explanation + %h2= pluralize(@bike.errors.count, "error") + " prohibited this bike from being saved:" + %ul + - @bike.errors.full_messages.each do |msg| + %li= msg + = render 'fields', f: f + .row + .actions.col-sm-offset-2 + = f.submit class: "btn btn-default" diff --git a/app/views/bikes/edit.html.erb b/app/views/bikes/edit.html.erb deleted file mode 100644 index c22f2f7..0000000 --- a/app/views/bikes/edit.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -
-

Editing bike

- - <%= render 'form' %> - - <%= link_to 'Show', @bike %> | - <%= link_to 'Back', bikes_path %> -
diff --git a/app/views/bikes/edit.html.haml b/app/views/bikes/edit.html.haml new file mode 100644 index 0000000..ad45be9 --- /dev/null +++ b/app/views/bikes/edit.html.haml @@ -0,0 +1,6 @@ +.container + %h1 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 deleted file mode 100644 index 3c84141..0000000 --- a/app/views/bikes/index.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -
- -

Bikes

- - - - - - - - - - - - - <% @bikes.each do |bike| %> - - - - - - - - <% end %> - -
Brand Model
<%= 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?' } %>
- -
- <%= link_to ' + Log Bike', new_bike_path, class: "btn btn-default" %> -
diff --git a/app/views/bikes/index.html.haml b/app/views/bikes/index.html.haml new file mode 100644 index 0000000..c7ca991 --- /dev/null +++ b/app/views/bikes/index.html.haml @@ -0,0 +1,22 @@ +.container + %h1 Bikes + + %table.table.table-striped.table-bordered.table-hover + %thead + %tr + %th Brand + %th Model + %th + %th + %th + %tbody + - @bikes.each do |bike| + %tr + %td= bike.brand + %td= bike.model + %td= link_to 'Show', bike + %td= link_to 'Edit', edit_bike_path(bike) + %td= link_to 'Destroy', bike, method: :delete, data: { confirm: 'Are you sure?' } + + %br + = link_to ' + Log Bike', new_bike_path, class: "btn btn-default" diff --git a/app/views/bikes/new.html.erb b/app/views/bikes/new.html.erb deleted file mode 100644 index d1d0eab..0000000 --- a/app/views/bikes/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New bike

- -<%= render 'form' %> - -<%= link_to 'Back', bikes_path %> diff --git a/app/views/bikes/new.html.haml b/app/views/bikes/new.html.haml new file mode 100644 index 0000000..a19579d --- /dev/null +++ b/app/views/bikes/new.html.haml @@ -0,0 +1,3 @@ +%h1 New bike += render 'form' += link_to 'Back', bikes_path diff --git a/app/views/bikes/show.html.erb b/app/views/bikes/show.html.erb deleted file mode 100644 index 1a25cf6..0000000 --- a/app/views/bikes/show.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -
-

<%= 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 %> -
diff --git a/app/views/bikes/show.html.haml b/app/views/bikes/show.html.haml new file mode 100644 index 0000000..e292bfa --- /dev/null +++ b/app/views/bikes/show.html.haml @@ -0,0 +1,7 @@ +.container + %p#notice= notice + = form_for(@bike) do |f| + = render 'fields', f: f, disabled: true + = link_to 'Edit', edit_bike_path(@bike) + | + = link_to 'Back', bikes_path diff --git a/app/views/static_pages/home.html.erb b/app/views/static_pages/home.html.erb deleted file mode 100644 index 23b95c8..0000000 --- a/app/views/static_pages/home.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -
-

Bicycle Data Tracker

- <%= link_to "Bikes", bikes_path %> -
- <%= link_to "Volunteers", volunteers_path %> -
diff --git a/app/views/static_pages/home.html.haml b/app/views/static_pages/home.html.haml new file mode 100644 index 0000000..248cb37 --- /dev/null +++ b/app/views/static_pages/home.html.haml @@ -0,0 +1,5 @@ +.container + %h1 Bicycle Data Tracker + = link_to "Bikes", bikes_path + %br + = link_to "Volunteers", volunteers_path diff --git a/app/views/volunteers/_fields.html.erb b/app/views/volunteers/_fields.html.erb deleted file mode 100644 index 5a71aa6..0000000 --- a/app/views/volunteers/_fields.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -<% disabled ||= false %> - -
- <%= f.label "Name", class: "col-sm-2 control-label" %> -
- <%= f.text_field :name, class: "form-control", disabled: disabled %> -
-
- -
- <%= f.label "Email address:", class: "col-sm-2 control-label" %> -
- <%= f.text_field :email, class: "form-control", disabled: disabled %> -
-
- -
- <%= f.label "Phone Number:", class: "col-sm-2 control-label" %> -
- <%= f.text_field :phone, class: "form-control", disabled: disabled %> -
-
- diff --git a/app/views/volunteers/_fields.html.haml b/app/views/volunteers/_fields.html.haml new file mode 100644 index 0000000..7ecb8ec --- /dev/null +++ b/app/views/volunteers/_fields.html.haml @@ -0,0 +1,17 @@ +- disabled ||= false + +.form-group + = f.label "Name", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :name, class: "form-control", disabled: disabled + +.form-group + = f.label "Email address:", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :email, class: "form-control", disabled: disabled + +.form-group + = f.label "Phone Number:", class: "col-sm-2 control-label" + .col-sm-10 + = f.text_field :phone, class: "form-control", disabled: disabled + diff --git a/app/views/volunteers/_form.html.erb b/app/views/volunteers/_form.html.erb deleted file mode 100644 index 8799ba7..0000000 --- a/app/views/volunteers/_form.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -
- <%= form_for @volunteer, html: {class: 'form-horizontal'} do |f| %> - <% if @volunteer.errors.any? %> -
-

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

- - -
- <% end %> - - <%= render 'fields', f: f %> - -
-
- <%= f.submit class: "btn btn-default" %> -
-
- <% end %> -
diff --git a/app/views/volunteers/_form.html.haml b/app/views/volunteers/_form.html.haml new file mode 100644 index 0000000..d6892bb --- /dev/null +++ b/app/views/volunteers/_form.html.haml @@ -0,0 +1,12 @@ +.container + = form_for @volunteer, html: {class: 'form-horizontal'} do |f| + - if @volunteer.errors.any? + #error_explanation + %h2= pluralize(@volunteer.errors.count, "error") + "prohibited this volunteer from being saved:" + %ul + - @volunteer.errors.full_messages.each do |msg| + %li= msg + = render 'fields', f: f + .row + .actions.col-sm-offset-2 + = f.submit class: "btn btn-default" diff --git a/app/views/volunteers/edit.html.erb b/app/views/volunteers/edit.html.erb deleted file mode 100644 index 676307d..0000000 --- a/app/views/volunteers/edit.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -
-

Editing Volunteer Information

- - <%= render 'form' %> - - <%= link_to 'Show', @volunteer %> | - <%= link_to 'Back', volunteers_path %> -
diff --git a/app/views/volunteers/edit.html.haml b/app/views/volunteers/edit.html.haml new file mode 100644 index 0000000..b3bc91e --- /dev/null +++ b/app/views/volunteers/edit.html.haml @@ -0,0 +1,6 @@ +.container + %h1 Editing Volunteer Information + = render 'form' + = link_to 'Show', @volunteer + | + = link_to 'Back', volunteers_path diff --git a/app/views/volunteers/index.html.erb b/app/views/volunteers/index.html.erb deleted file mode 100644 index 22d8a1a..0000000 --- a/app/views/volunteers/index.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -
-

Volunteers

- - - - - - - - - - - - - <% @volunteers.each do |volunteer| %> - - - - - - - - - <% end %> - -
Name Phone Email
<%= volunteer.name %><%= volunteer.phone %><%= volunteer.email %><%= link_to 'Show', volunteer %><%= link_to 'Edit', edit_volunteer_path(volunteer) %><%= link_to 'Destroy', volunteer, method: :delete, data: { confirm: 'Are you sure?' } %>
- - <%= link_to '+ Add Volunteer', new_volunteer_path, class: "btn btn-default" %> -
- diff --git a/app/views/volunteers/index.html.haml b/app/views/volunteers/index.html.haml new file mode 100644 index 0000000..e2c59c3 --- /dev/null +++ b/app/views/volunteers/index.html.haml @@ -0,0 +1,23 @@ +.container + %h1 Volunteers + %table.table.table-striped.table-bordered.table-hover + %thead + %tr + %th Name + %th Phone + %th Email + %th + %th + %th + %tbody + - @volunteers.each do |volunteer| + %tr + %td= volunteer.name + %td= volunteer.phone + %td= volunteer.email + %td= link_to 'Show', volunteer + %td= link_to 'Edit', edit_volunteer_path(volunteer) + %td= link_to 'Destroy', volunteer, method: :delete, data: { confirm: 'Are you sure?' } + + = link_to '+ Add Volunteer', new_volunteer_path, class: "btn btn-default" + diff --git a/app/views/volunteers/new.html.erb b/app/views/volunteers/new.html.erb deleted file mode 100644 index 82b4549..0000000 --- a/app/views/volunteers/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -

New Volunteer

- -<%= render 'form' %> - -<%= link_to 'Back', volunteers_path %> diff --git a/app/views/volunteers/new.html.haml b/app/views/volunteers/new.html.haml new file mode 100644 index 0000000..1b4178c --- /dev/null +++ b/app/views/volunteers/new.html.haml @@ -0,0 +1,3 @@ +%h1 New Volunteer += render 'form' += link_to 'Back', volunteers_path diff --git a/app/views/volunteers/show.html.erb b/app/views/volunteers/show.html.erb deleted file mode 100644 index 6155e1a..0000000 --- a/app/views/volunteers/show.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -
-

<%= notice %>

- <%= form_for(@volunteer) do |f| %> - <%= render 'fields', f: f, disabled: true %> - <% end %> - - <%= link_to 'Edit', edit_volunteer_path(@volunteer) %> | - <%= link_to 'Back', volunteers_path %> -
diff --git a/app/views/volunteers/show.html.haml b/app/views/volunteers/show.html.haml new file mode 100644 index 0000000..0ab4162 --- /dev/null +++ b/app/views/volunteers/show.html.haml @@ -0,0 +1,7 @@ +.container + %p#notice= notice + = form_for(@volunteer) do |f| + = render 'fields', f: f, disabled: true + = link_to 'Edit', edit_volunteer_path(@volunteer) + | + = link_to 'Back', volunteers_path