mirror of
				https://github.com/fspc/BikeShed-1.git
				synced 2025-10-31 08:55:36 -04:00 
			
		
		
		
	Merge pull request #75 from spacemunkay/default-dropdown-values-67
Default dropdown values 67
This commit is contained in:
		
						commit
						3bea39b53a
					
				| @ -20,7 +20,7 @@ class BikeLogs < Netzke::Basepack::Grid | |||||||
|       { :name => :start_date, :format => "g:ia - D, M j - Y", :width => 165, :default_value => Time.now.to_formatted_s(:db)  }, |       { :name => :start_date, :format => "g:ia - D, M j - Y", :width => 165, :default_value => Time.now.to_formatted_s(:db)  }, | ||||||
|       { :name => :end_date, :hidden => true, :default_value => Time.now.to_formatted_s(:db) }, |       { :name => :end_date, :hidden => true, :default_value => Time.now.to_formatted_s(:db) }, | ||||||
|       :description, |       :description, | ||||||
|       { :name => :bike_action__action, :text => 'Action'}, |       { :name => :bike_action__action, :text => 'Action', :default_value => ::ActsAsLoggable::BikeAction.first.id}, | ||||||
|       { :name => :logged_by, :getter => lambda{ |rec| |       { :name => :logged_by, :getter => lambda{ |rec| | ||||||
|                                                 user = User.find_by_id(rec.logger_id) |                                                 user = User.find_by_id(rec.logger_id) | ||||||
|                                                 user.nil? ? "" : "#{user.first_name} #{user.last_name}" |                                                 user.nil? ? "" : "#{user.first_name} #{user.last_name}" | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ class Bikes < Netzke::Basepack::Grid | |||||||
|     # columns with :id set, have :min_chars set in init_component |     # columns with :id set, have :min_chars set in init_component | ||||||
|     # See: http://stackoverflow.com/questions/17738962/netzke-grid-filtering |     # See: http://stackoverflow.com/questions/17738962/netzke-grid-filtering | ||||||
|     c.columns = [ |     c.columns = [ | ||||||
|       { :name => :shop_id, :text => 'Shop ID'}, |       { :name => :shop_id, :text => 'Shop ID', :default_value => Bike.last.id.to_i + 1}, | ||||||
|       :serial_number, |       :serial_number, | ||||||
|       { :id => :bike_brand__brand, :name => :bike_brand__brand, :text => 'Brand'}, |       { :id => :bike_brand__brand, :name => :bike_brand__brand, :text => 'Brand'}, | ||||||
|       { :name => :model, :text => 'Model', |       { :name => :model, :text => 'Model', | ||||||
| @ -19,14 +19,15 @@ class Bikes < Netzke::Basepack::Grid | |||||||
|                   } |                   } | ||||||
|       }, |       }, | ||||||
|       #needs to have type :action or else won't work in grid, because... netzke |       #needs to have type :action or else won't work in grid, because... netzke | ||||||
|       { :name => "color", :text => "Frame Color", :type => :action, :editor => { :xtype => "xcolorcombo"}, :renderer => :color_block}, |       { :name => "color", :text => "Frame Color", :type => :action, :editor => { :xtype => "xcolorcombo"}, :renderer => :color_block, | ||||||
|       { :id => :bike_style__style, :name => :bike_style__style, :text => 'Style' }, |         :default_value => '000000'}, | ||||||
|  |       { :id => :bike_style__style, :name => :bike_style__style, :text => 'Style', :default_value => BikeStyle.first.id}, | ||||||
|       { :name => :seat_tube_height, :text => 'Seat Tube (in)'}, |       { :name => :seat_tube_height, :text => 'Seat Tube (in)'}, | ||||||
|       { :name => :top_tube_length, :text => 'Top Tube (in)'}, |       { :name => :top_tube_length, :text => 'Top Tube (in)'}, | ||||||
|       { :name => :wheel_size, :text => 'Wheel Size (in)'}, |       { :name => :wheel_size, :text => 'Wheel Size (in)'}, | ||||||
|       :value, |       :value, | ||||||
|       { :id => :bike_condition__condition, :name => :bike_condition__condition, :text => 'Condition'}, |       { :id => :bike_condition__condition, :name => :bike_condition__condition, :text => 'Condition', :default_value => BikeCondition.first.id}, | ||||||
|       { :id => :bike_purpose__purpose, :name => :bike_purpose__purpose, :text => 'Purpose'}, |       { :id => :bike_purpose__purpose, :name => :bike_purpose__purpose, :text => 'Purpose', :default_value => BikePurpose.first.id}, | ||||||
|       { :name => :owner, :getter => lambda { |rec| |       { :name => :owner, :getter => lambda { |rec| | ||||||
|                                               user = rec.owner |                                               user = rec.owner | ||||||
|                                               user.nil? ? "" : "#{user.first_name} #{user.last_name}" |                                               user.nil? ? "" : "#{user.first_name} #{user.last_name}" | ||||||
|  | |||||||
| @ -20,7 +20,7 @@ class TransactionLogs < Netzke::Basepack::Grid | |||||||
|     c.columns = [ |     c.columns = [ | ||||||
|       { :name => :start_date, :format => "g:ia - D, M j - Y", :width => 165, :default_value => Time.now.to_formatted_s(:db), :text => 'Date'  }, |       { :name => :start_date, :format => "g:ia - D, M j - Y", :width => 165, :default_value => Time.now.to_formatted_s(:db), :text => 'Date'  }, | ||||||
|       { :name => :description, :text => "Amount"} , |       { :name => :description, :text => "Amount"} , | ||||||
|       { :name => :transaction_action__action, :text => 'Method'}, |       { :name => :transaction_action__action, :text => 'Method', :default_value => ::ActsAsLoggable::TransactionAction.first.id}, | ||||||
|       { :name => :logged_by, :getter => lambda{ |rec| |       { :name => :logged_by, :getter => lambda{ |rec| | ||||||
|           user = User.find_by_id(rec.logger_id) |           user = User.find_by_id(rec.logger_id) | ||||||
|           user.nil? ? "" : "#{user.first_name} #{user.last_name}" |           user.nil? ? "" : "#{user.first_name} #{user.last_name}" | ||||||
|  | |||||||
| @ -10,9 +10,9 @@ class UserRoleJoins < Netzke::Basepack::Grid | |||||||
|       { :name => :name, :getter => lambda{ |rec| |       { :name => :name, :getter => lambda{ |rec| | ||||||
|                                                 user = User.find_by_id(rec.user_id) |                                                 user = User.find_by_id(rec.user_id) | ||||||
|                                                 user.nil? ? "" : "#{user.first_name} #{user.last_name}" |                                                 user.nil? ? "" : "#{user.first_name} #{user.last_name}" | ||||||
|                                               } |                                               }, | ||||||
|       }, |       }, | ||||||
|       { :name => :role__role, :text => "Role"}, |       { :name => :role__role, :text => "Role", :default_value => Role.exists? ? Role.first.id : nil}, | ||||||
|       :created_at, |       :created_at, | ||||||
|       :updated_at, |       :updated_at, | ||||||
|       :ends ] |       :ends ] | ||||||
|  | |||||||
| @ -18,7 +18,7 @@ class Users < Netzke::Basepack::Grid | |||||||
|       :first_name, |       :first_name, | ||||||
|       :last_name, |       :last_name, | ||||||
|       :email, |       :email, | ||||||
|       { :id => :bike__shop_id, :name => :bike__shop_id} |       { :text => "Bike - Shop ID", :id => :bike__shop_id, :name => :bike__shop_id, :default_value => Bike.exists? ? Bike.first.id : nil } | ||||||
|     ] |     ] | ||||||
| 
 | 
 | ||||||
|     c.columns << :reset if can? :manage, User |     c.columns << :reset if can? :manage, User | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user