mirror of
https://github.com/fspc/bike-database.git
synced 2025-03-12 01:23:23 -04:00
Louis | Abstracts freecyclery functionality and adds closed applications page
This commit is contained in:
parent
77e7109b9e
commit
b717cba355
@ -38,10 +38,6 @@ class BikesController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def freecyclery_pickup
|
|
||||||
@bikes_for_pickup = Bike.bikes_ready_for_pickup
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @bike.update(bike_params)
|
if @bike.update(bike_params)
|
||||||
redirect_to @bike, notice: 'Bike was successfully updated.'
|
redirect_to @bike, notice: 'Bike was successfully updated.'
|
||||||
|
13
app/controllers/freecyclery_controller.rb
Normal file
13
app/controllers/freecyclery_controller.rb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
class FreecycleryController < ApplicationController
|
||||||
|
before_action :authenticate_user!
|
||||||
|
|
||||||
|
def closed_applications
|
||||||
|
@closed_applications = Client.closed_applications
|
||||||
|
end
|
||||||
|
|
||||||
|
def ready_for_pickup
|
||||||
|
@bikes_for_pickup = Bike.bikes_ready_for_pickup
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
@ -13,4 +13,8 @@ class Client < ActiveRecord::Base
|
|||||||
self.first_name + ' ' + self.last_name
|
self.first_name + ' ' + self.last_name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.closed_applications
|
||||||
|
Client.all.select{|client| client.application_voided || client.completion_date}
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
19
app/views/freecyclery/closed_applications.html.haml
Normal file
19
app/views/freecyclery/closed_applications.html.haml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
.container
|
||||||
|
.row
|
||||||
|
%h1 Closed Applications
|
||||||
|
|
||||||
|
%table.table.table-striped.table-bordered.table-hover
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th Name
|
||||||
|
%th Voided
|
||||||
|
%th Completed
|
||||||
|
%th Show
|
||||||
|
%tbody
|
||||||
|
- @closed_applications.each do |client|
|
||||||
|
%tr
|
||||||
|
%td= client.name
|
||||||
|
%td= client.application_voided
|
||||||
|
%td= client.completion_date
|
||||||
|
%td= link_to 'Show', client
|
||||||
|
%br
|
@ -9,4 +9,6 @@
|
|||||||
%br
|
%br
|
||||||
= link_to "Freecyclery Agencies", agencies_path
|
= link_to "Freecyclery Agencies", agencies_path
|
||||||
%br
|
%br
|
||||||
= link_to "Freecyclery Bikes Ready for Pickup", freecyclery_pickup_bikes_path
|
= link_to "Freecyclery Bikes Ready for Pickup", ready_for_pickup_path
|
||||||
|
%br
|
||||||
|
= link_to "Freecyclery Closed Applications", closed_applications_path
|
||||||
|
@ -12,4 +12,8 @@ Bikedb::Application.routes.draw do
|
|||||||
resources :volunteers
|
resources :volunteers
|
||||||
resources :agencies
|
resources :agencies
|
||||||
resources :clients
|
resources :clients
|
||||||
|
|
||||||
|
get 'closed_applications' => 'freecyclery#closed_applications'
|
||||||
|
get 'ready_for_pickup' => 'freecyclery#ready_for_pickup'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user