Almost usable, still a lot of work left

-Moved bikes to User model instead of profile
-User can copy user log to a bike log with new actsasloggable
-Added user stats
-some css was messing up checkboxes, need to figure out which stylesheet was doing that
This commit is contained in:
Jason Denney
2012-12-31 15:38:34 -05:00
parent 922af526c1
commit 189137ba9d
15 changed files with 117 additions and 17 deletions
+17 -3
View File
@@ -6,7 +6,10 @@ class UserLogs < Netzke::Basepack::Grid
#all users
user_log_strong_default_attrs = {
:loggable_type => 'User',
:log_action_type => 'ActsAsLoggable::UserAction'
:log_action_type => 'ActsAsLoggable::UserAction',
:copy_type => 'Bike',
:copy_action_type => 'ActsAsLoggable::BikeAction',
:copy_action_id => 3
}
#just users
@@ -40,11 +43,21 @@ class UserLogs < Netzke::Basepack::Grid
end
def default_fields_for_forms
#figure out a better way to do this
bike_store = Bike.all.map { |b| [b.id, b.serial_number] }
current_user ||= User.find_by_id(session[:selected_user_id]) || controller.current_user
bike_id = current_user.bike.nil? ? nil : current_user.bike.id
puts "YOOOOO BIKE: #{bike_id}"
[
{ :name => :start_date},
{ :name => :end_date},
:description,
{ :name => :user_action__action, :field_label => 'Action'}
{ :name => :description},
{ :name => :user_action__action, :field_label => 'Action'},
{ :name => :for_bike, :title => "Copy description to a Bike's History?", :xtype => 'fieldset', :collapsible => true, :collapsed => true, :items => [
{:xtype => 'checkbox', :name => :copy_log, :inputValue => true, :read_only => false},
{:xtype => 'combo', :name => :copy_id, :fieldLabel => 'Bike', :store => bike_store, :value => bike_id}
]
}
]
end
@@ -52,4 +65,5 @@ class UserLogs < Netzke::Basepack::Grid
def default_bbar
[ :apply, :add_in_form, :search ]
end
end