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
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

3
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" }

Loading…
Cancel
Save