From b480d7b405a1e2f6286754c5adad3d5efbdb2ea3 Mon Sep 17 00:00:00 2001 From: Louis Knapp Date: Fri, 18 Sep 2015 13:48:16 -0500 Subject: [PATCH] lk | changes order of bikes and adds log bikes button to home page --- app/controllers/bikes_controller.rb | 2 +- app/views/bikes/index.html.haml | 6 +++--- app/views/static_pages/home.html.haml | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/controllers/bikes_controller.rb b/app/controllers/bikes_controller.rb index d25bb8c..433a8b9 100644 --- a/app/controllers/bikes_controller.rb +++ b/app/controllers/bikes_controller.rb @@ -3,7 +3,7 @@ class BikesController < ApplicationController before_action :authenticate_user! def index - @bikes = Bike.all + @bikes = Bike.all.order(:log_number).reverse_order @unsold_bikes = @bikes.select{ |bike| !bike.date_sold && (bike.purpose == "Sale") diff --git a/app/views/bikes/index.html.haml b/app/views/bikes/index.html.haml index 7fb8ecc..a22092e 100644 --- a/app/views/bikes/index.html.haml +++ b/app/views/bikes/index.html.haml @@ -14,7 +14,7 @@ %tbody - @unsold_bikes.each do |bike| %tr - %td= bike.brand + %td= bike.brand %td= bike.model %td= link_to 'Show', bike %td= link_to 'Edit', edit_bike_path(bike) @@ -30,8 +30,8 @@ %tbody - @bikes.each do |bike| %tr - %td= bike.brand + %td= bike.brand %td= bike.model %td= link_to 'Show', bike %td= link_to 'Edit', edit_bike_path(bike) - + diff --git a/app/views/static_pages/home.html.haml b/app/views/static_pages/home.html.haml index 47a689f..53c7ac7 100644 --- a/app/views/static_pages/home.html.haml +++ b/app/views/static_pages/home.html.haml @@ -3,6 +3,8 @@ %br %h2 Bikes %br + = link_to "Log Bikes", new_bike_path + %br = link_to "View All Bikes", bikes_path %br = link_to "Print Sale Bike Labels", print_select_bikes_path @@ -15,7 +17,7 @@ %br = link_to "Freecyclery Bikes Ready for Pickup", ready_for_pickup_path %br - = link_to "Freecyclery Closed Applications", closed_applications_path + = link_to "Freecyclery Closed Applications", closed_applications_path %br = link_to "Available Bikes", available_bikes_path %h2 Reports