Louis | Adds page for available freecyclery bikes

This commit is contained in:
Loos
2014-10-09 19:42:08 -04:00
parent b717cba355
commit 9fad8ded1b
6 changed files with 58 additions and 2 deletions
@@ -9,5 +9,8 @@ class FreecycleryController < ApplicationController
@bikes_for_pickup = Bike.bikes_ready_for_pickup
end
def available_bikes
@available_bikes = Bike.available_for_freecyclery
end
end
+4
View File
@@ -23,4 +23,8 @@ class Bike < ActiveRecord::Base
Bike.all.select{|bike| bike.ready_for_pickup?}
end
def self.available_for_freecyclery
Bike.all.select{|bike| bike.completion_date && (bike.purpose == "Freecyclery") && !bike.client }
end
end
@@ -0,0 +1,15 @@
.container
%br
%h1 Available Freecyclery Bikes
%table.table.table-striped.table-bordered.table-hover
%thead
%tr
%th Brand
%th Model
%tbody
- @available_bikes.each do |bike|
%tr
%td= bike.brand
%td= bike.model
+8 -2
View File
@@ -1,14 +1,20 @@
.container
%h1 Bike &amp; Client Tracker
%br
%h2 Bikes
%br
= link_to "View All Bikes", bikes_path
%br
= link_to "Freecyclery Clients", clients_path
%br
= link_to "Print Sale Bike Labels", print_select_bikes_path
%br
%h2 Freecyclery
%br
= link_to "Freecyclery Clients", clients_path
%br
= link_to "Freecyclery Agencies", agencies_path
%br
= link_to "Freecyclery Bikes Ready for Pickup", ready_for_pickup_path
%br
= link_to "Freecyclery Closed Applications", closed_applications_path
%br
= link_to "Available Bikes", available_bikes_path