From 0f890e12e9447ba83131b0cf3e5d0d2bc470a422 Mon Sep 17 00:00:00 2001 From: Jason Denney Date: Sat, 18 Jan 2014 18:25:21 -0500 Subject: [PATCH] Added bikes views *Added new bike template --- app/assets/javascripts/bikes.js | 1 + app/controllers/bikes_controller.rb | 6 ++++ app/views/bikes/new.html.haml | 45 +++++++++++++++++++++++++++++ app/views/bikes/show.html.haml | 1 + app/views/site/index.html.haml | 2 +- config/routes.rb | 5 +++- 6 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 app/assets/javascripts/bikes.js create mode 100644 app/controllers/bikes_controller.rb create mode 100644 app/views/bikes/new.html.haml create mode 100644 app/views/bikes/show.html.haml diff --git a/app/assets/javascripts/bikes.js b/app/assets/javascripts/bikes.js new file mode 100644 index 0000000..f7d2a50 --- /dev/null +++ b/app/assets/javascripts/bikes.js @@ -0,0 +1 @@ +$('.btn').button(); diff --git a/app/controllers/bikes_controller.rb b/app/controllers/bikes_controller.rb new file mode 100644 index 0000000..41ff3a8 --- /dev/null +++ b/app/controllers/bikes_controller.rb @@ -0,0 +1,6 @@ +class BikesController < AuthenticatedController + + def new + end + +end diff --git a/app/views/bikes/new.html.haml b/app/views/bikes/new.html.haml new file mode 100644 index 0000000..27b775a --- /dev/null +++ b/app/views/bikes/new.html.haml @@ -0,0 +1,45 @@ += stylesheet_link_tag "bootstrap_and_overrides", :media => "all" +%h2 Add Bike + +%p + %p + %input{id: "bike_shop_id", placeholder: "Shop ID", type: "number", min:0, class: "input-lg" } + %p + %select{id: "bike_brand_id"} + %option Select a brand + %option Huffy + %option Raleigh + %p + %input{id: "bike_model", placeholder: "Model", type: "text", class: "input-lg" } + %p + .btn-group{ "data-toggle" => "buttons"} + %label{ class: "btn btn-default"} + %input{ type: "radio", name: "options"} RD + %label{ class: "btn btn-default"} + %input{ type: "radio", name: "options"} MTN + %label{ class: "btn btn-default"} + %input{ type: "radio", name: "options"} HYB + %label{ class: "btn btn-default"} + %input{ type: "radio", name: "options"} OTHER + %p + %select{id: "bike_wheel_size"} + %option Selet a wheel size + %option 27 x 1,75 + %option 26 x 1,75 + %p + .btn-group{ "data-toggle" => "buttons"} + %label{ class: "btn btn-default"} + %input{ type: "radio", name: "options"} Poor + %label{ class: "btn btn-default"} + %input{ type: "radio", name: "options"} Fair + %label{ class: "btn btn-default"} + %input{ type: "radio", name: "options"} Good + %label{ class: "btn btn-default"} + %input{ type: "radio", name: "options"} Excellent + %p + %input{id: "bike_seat_tube", placeholder: "Seat Tube", type: "number", min: 0, max: 100, class: "input-lg" } + %p + %input{id: "bike_description", placeholder: "Short description", type: "text", class: "input-lg" } + %p + %input{id: "index_logout", value: "Add Bike", type: "button", class: "btn btn-lg btn-block btn-primary", "data-url" => "api_add_bike_path"} + diff --git a/app/views/bikes/show.html.haml b/app/views/bikes/show.html.haml new file mode 100644 index 0000000..3f950e2 --- /dev/null +++ b/app/views/bikes/show.html.haml @@ -0,0 +1 @@ +Bike Show diff --git a/app/views/site/index.html.haml b/app/views/site/index.html.haml index 010db52..6f93462 100644 --- a/app/views/site/index.html.haml +++ b/app/views/site/index.html.haml @@ -7,7 +7,7 @@ %p %a{class: "btn btn-lg btn-block btn-primary"} View Timesheet %p - %a{class: "btn btn-lg btn-block btn-primary"} Add Bike + %a{class: "btn btn-lg btn-block btn-primary", href: new_bike_path} Add Bike %p Your Bikes: %ol diff --git a/config/routes.rb b/config/routes.rb index ecc2dec..ece020b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,10 @@ Velocipede::Application.routes.draw do netzke root :to => 'site#index' - get 'admin/index' => 'panel#index', :as => "admin_index" + get 'admin/index', to: 'panel#index', as: "admin_index" + + get 'bikes/new', to: 'bikes#new', as: "new_bike" + get 'bikes/:id', to: 'bikes#show', as: "bike" ########################### # API Routes