mirror of https://github.com/fspc/BikeShed-1.git
Edwin Perez
11 years ago
5 changed files with 101 additions and 24 deletions
@ -0,0 +1,29 @@ |
|||
# The User Log Add Item Form |
|||
class UserLogsAddItem < Netzke::Basepack::Form |
|||
def configure(c) |
|||
super |
|||
c.model = 'ActsAsLoggable::Log' |
|||
|
|||
#figure out a better way to do this |
|||
bike_store = Bike.all.map { |b| [b.id, b.shop_id] } |
|||
current_user ||= User.find_by_id(session[:selected_user_id]) || controller.current_user |
|||
bike_id = current_user.bike.nil? ? nil : current_user.bike.id |
|||
c.items = [ |
|||
{ :no_binding => true, :xtype => 'displayfield', :fieldLabel => "Log for:", :value => "#{current_user.to_s}"}, |
|||
{ :name => :start_date}, |
|||
{ :id => :user_logs_add_form_hours, :no_binding => true, :name => :hours, :xtype => 'field', :fieldLabel => "Hours:" }, |
|||
{ :id => :user_logs_add_form_end_date, :name => :end_date, :hidden => true }, |
|||
{ :name => :description}, |
|||
#had to hack acts_as_loggable/log.rb to get this to work |
|||
{ :name => :user_action__action, :field_label => 'Action'}, |
|||
{ :name => :for_bike, :checkboxName => :copy_log, :inputValue => true, :title => "Copy description to a Bike's History?", :xtype => 'fieldset', :checkboxToggle => true, :collapsed => true, :items => [ |
|||
{:xtype => 'combo', :no_binding => true, :name => :copy_id, :title => 'Bike', :fieldLabel => 'Bike', :store => bike_store, :value => bike_id} |
|||
] |
|||
} |
|||
] |
|||
end |
|||
|
|||
js_configure do |c| |
|||
c.mixin :init_component |
|||
end |
|||
end |
@ -0,0 +1,21 @@ |
|||
{ |
|||
initComponent: function(){ |
|||
// calling superclass's initComponent
|
|||
this.callParent(); |
|||
|
|||
var panel = this; |
|||
var theForm = this.getForm(); |
|||
|
|||
console.log(theForm); |
|||
|
|||
var hoursInput = Ext.getCmp('user_logs_add_form_hours'); |
|||
|
|||
console.log(hoursInput); |
|||
|
|||
hoursInput.on('change', function(e){ |
|||
console.log('I am changing'); |
|||
}); |
|||
|
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue