From 67ae0bf04b06120b2279193e317836a7ecd78aee Mon Sep 17 00:00:00 2001 From: Loos Date: Fri, 10 Oct 2014 18:47:44 -0500 Subject: [PATCH] WIP | Louis | Adding client receipts --- Gemfile | 1 + Gemfile.lock | 4 ++++ app/controllers/clients_controller.rb | 20 ++++++++------------ app/controllers/freecyclery_controller.rb | 4 ++++ app/views/freecyclery/receipt.html.haml | 1 + config/routes.rb | 4 +++- notes.txt | 4 ++++ 7 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 app/views/freecyclery/receipt.html.haml diff --git a/Gemfile b/Gemfile index 3c68b35..2fe6b6b 100644 --- a/Gemfile +++ b/Gemfile @@ -23,6 +23,7 @@ group :test, :development do gem 'pry-rails' gem 'better_errors' gem 'assert_difference' + gem 'binding_of_caller' # Uncomment this line on OS X. gem 'growl', '1.0.3' diff --git a/Gemfile.lock b/Gemfile.lock index 31db61b..d76ab00 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,6 +33,8 @@ GEM better_errors (1.1.0) coderay (>= 1.0.0) erubis (>= 2.6.6) + binding_of_caller (0.7.2) + debug_inspector (>= 0.0.1) bootstrap-sass (2.3.2.0) sass (~> 3.2) builder (3.1.4) @@ -52,6 +54,7 @@ GEM coffee-script-source execjs coffee-script-source (1.6.3) + debug_inspector (0.0.2) devise (3.2.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) @@ -192,6 +195,7 @@ DEPENDENCIES assert_difference bcrypt-ruby (= 3.1.2) better_errors + binding_of_caller bootstrap-sass (= 2.3.2.0) capybara (= 2.1.0) devise diff --git a/app/controllers/clients_controller.rb b/app/controllers/clients_controller.rb index 3b53b37..2d16b65 100644 --- a/app/controllers/clients_controller.rb +++ b/app/controllers/clients_controller.rb @@ -19,22 +19,18 @@ class ClientsController < ApplicationController def create @client = Client.new(client_params) - respond_to do |format| - if @client.save - format.html { redirect_to @client, notice: 'Client was successfully created.' } - else - format.html { render action: 'new' } - end + if @client.save + redirect_to @client, notice: 'Client was successfully created.' + else + render action: 'new' end end def update - respond_to do |format| - if @client.update(client_params) - format.html { redirect_to @client, notice: 'Client was successfully updated.' } - else - format.html { render action: 'edit' } - end + if @client.update(client_params) + redirect_to @client, notice: 'Client was successfully updated.' + else + render action: 'edit' end end diff --git a/app/controllers/freecyclery_controller.rb b/app/controllers/freecyclery_controller.rb index cd2fb50..7d96b1e 100644 --- a/app/controllers/freecyclery_controller.rb +++ b/app/controllers/freecyclery_controller.rb @@ -13,4 +13,8 @@ class FreecycleryController < ApplicationController @available_bikes = Bike.available_for_freecyclery end + def receipt + @client = Client.find(params[:client_id]) + end + end diff --git a/app/views/freecyclery/receipt.html.haml b/app/views/freecyclery/receipt.html.haml new file mode 100644 index 0000000..b79074f --- /dev/null +++ b/app/views/freecyclery/receipt.html.haml @@ -0,0 +1 @@ +KITTENS diff --git a/config/routes.rb b/config/routes.rb index 6d19277..238d670 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,7 +11,9 @@ Bikedb::Application.routes.draw do resources :volunteers resources :agencies - resources :clients + resources :clients do + get 'receipt' => 'freecyclery#receipt' + end get 'closed_applications' => 'freecyclery#closed_applications' get 'ready_for_pickup' => 'freecyclery#ready_for_pickup' diff --git a/notes.txt b/notes.txt index 3c2bc0f..d748adb 100644 --- a/notes.txt +++ b/notes.txt @@ -9,6 +9,7 @@ Reports Number of bikes donated according to agency. (Graph?) Average bike price for year. + assign a bike from the available freecyclery bikes page mark as picked up from the ready for pickup page validations around parameters that break site if incomplete @@ -24,4 +25,7 @@ refactor index - move unsold bikes to model make ‚recyclery‘ its own view folder, controller, etc. add a request-a-feature feature +add pics of bikes for sale +add recyclery logos & bike memorabilia pics all over app +