Browse Source

Allow user select bike worked when adding time

denney-fix-saving-dates
Jason Denney 11 years ago
parent
commit
b30203b750
  1. 6
      app/controllers/time_entries_controller.rb
  2. 3
      app/views/time_entries/new.haml

6
app/controllers/time_entries_controller.rb

@ -1,7 +1,11 @@
class TimeEntriesController < AuthenticatedController class TimeEntriesController < AuthenticatedController
def new 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 end
def index def index

3
app/views/time_entries/new.haml

@ -31,8 +31,7 @@
.control-group .control-group
.controls .controls
%label %label
Worked on a bike? = select_tag(:bike_brand_id, options_for_select(@bikes))
%input{ type: "checkbox"}
.control-group .control-group
.controls .controls
%textarea{id: "work_description", placeholder: "Work description", class: "input-lg" } %textarea{id: "work_description", placeholder: "Work description", class: "input-lg" }

Loading…
Cancel
Save