diff --git a/app/controllers/time_entries_controller.rb b/app/controllers/time_entries_controller.rb index 0b73db1..ce9913d 100644 --- a/app/controllers/time_entries_controller.rb +++ b/app/controllers/time_entries_controller.rb @@ -1,7 +1,11 @@ class TimeEntriesController < AuthenticatedController def new - + @bikes = Bike.all.map{ |b| [b.to_s , b.id] } + if bike = current_user.bike + @bikes.unshift( [bike.to_s, bike.id] ) + end + @bikes.unshift( ["Non-bike work", -1] ) end def index diff --git a/app/views/time_entries/new.haml b/app/views/time_entries/new.haml index 1774b27..8a4f12e 100644 --- a/app/views/time_entries/new.haml +++ b/app/views/time_entries/new.haml @@ -31,8 +31,7 @@ .control-group .controls %label - Worked on a bike? - %input{ type: "checkbox"} + = select_tag(:bike_brand_id, options_for_select(@bikes)) .control-group .controls %textarea{id: "work_description", placeholder: "Work description", class: "input-lg" }