mirror of
				https://github.com/fspc/BikeShed-1.git
				synced 2025-10-31 00:45:35 -04:00 
			
		
		
		
	Disable sub panels until item clicked
This commit is contained in:
		
							parent
							
								
									cda94cf955
								
							
						
					
					
						commit
						4a67ebe77e
					
				| @ -5,14 +5,30 @@ | |||||||
| 
 | 
 | ||||||
|     // setting the 'rowclick' event
 |     // setting the 'rowclick' event
 | ||||||
|     var view = this.getComponent('bikes').getView(); |     var view = this.getComponent('bikes').getView(); | ||||||
|  | 
 | ||||||
|  |     //disable until a bike is clicked
 | ||||||
|  |     var bike_logs_comp = this.queryById('bike_logs'); | ||||||
|  |     if( bike_logs_comp){ | ||||||
|  |       bike_logs_comp.disable(); | ||||||
|  |     } | ||||||
|  |     var bike_tasks_comp = this.queryById('tasks'); | ||||||
|  |     if( bike_tasks_comp ){ | ||||||
|  |       bike_tasks_comp.disable(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     view.on('itemclick', function(view, record){ |     view.on('itemclick', function(view, record){ | ||||||
|       // The beauty of using Ext.Direct: calling 3 endpoints in a row, which results in a single call to the server!
 |       // The beauty of using Ext.Direct: calling 3 endpoints in a row, which results in a single call to the server!
 | ||||||
|       this.selectBike({bike_id: record.get('id')}); |       this.selectBike({bike_id: record.get('id')}); | ||||||
|       if( this.queryById('bike_logs') ){ |       // query for these components again, can change if not visible because of accordian
 | ||||||
|         this.queryById('bike_logs').getStore().load(); |       var bike_logs_comp = this.queryById('bike_logs'); | ||||||
|  |       var bike_tasks_comp = this.queryById('tasks'); | ||||||
|  |       if( bike_logs_comp ){ | ||||||
|  |         bike_logs_comp.getStore().load(); | ||||||
|  |         bike_logs_comp.enable(); | ||||||
|       } |       } | ||||||
|       if( this.queryById('tasks') ){ |       if( bike_tasks_comp ){ | ||||||
|         this.queryById('tasks').getStore().load(); |         bike_tasks_comp.getStore().load(); | ||||||
|  |         bike_tasks_comp.enable(); | ||||||
|       } |       } | ||||||
|     }, this); |     }, this); | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -4,7 +4,6 @@ | |||||||
|     this.callParent(); |     this.callParent(); | ||||||
|     this.getView().on('itemclick', function(view, record){ |     this.getView().on('itemclick', function(view, record){ | ||||||
|       // The beauty of using Ext.Direct: calling 3 endpoints in a row, which results in a single call to the server!
 |       // The beauty of using Ext.Direct: calling 3 endpoints in a row, which results in a single call to the server!
 | ||||||
|       console.log("user: " + record.get('id') ); |  | ||||||
|       this.selectCustomer({customer_id: record.get('id'), customer_type: 'Customer'}); |       this.selectCustomer({customer_id: record.get('id'), customer_type: 'Customer'}); | ||||||
|     }, this); |     }, this); | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -2,6 +2,8 @@ class Tasks < Netzke::Basepack::Grid | |||||||
|   def configure(c) |   def configure(c) | ||||||
|     super |     super | ||||||
| 
 | 
 | ||||||
|  |     #disable by default, will be enabled once bike is clicked | ||||||
|  |     c.disabled = true | ||||||
|     task_list_id = nil |     task_list_id = nil | ||||||
|     if session[:selected_bike_id] |     if session[:selected_bike_id] | ||||||
|       task_list_id = Bike.find_by_id(session[:selected_bike_id]).task_list.id |       task_list_id = Bike.find_by_id(session[:selected_bike_id]).task_list.id | ||||||
|  | |||||||
| @ -5,10 +5,19 @@ | |||||||
| 
 | 
 | ||||||
|     // setting the 'rowclick' event
 |     // setting the 'rowclick' event
 | ||||||
|     var view = this.getComponent('transactions').getView(); |     var view = this.getComponent('transactions').getView(); | ||||||
|  | 
 | ||||||
|  |     if( this.queryById('transaction_logs')){ | ||||||
|  |       this.queryById('transaction_logs').disable(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     view.on('itemclick', function(view, record){ |     view.on('itemclick', function(view, record){ | ||||||
|       // The beauty of using Ext.Direct: calling 3 endpoints in a row, which results in a single call to the server!
 |       // The beauty of using Ext.Direct: calling 3 endpoints in a row, which results in a single call to the server!
 | ||||||
|       this.selectTransaction({transaction_id: record.get('id')}); |       this.selectTransaction({transaction_id: record.get('id')}); | ||||||
|       this.getComponent('transaction_logs').getStore().load(); |       this.getComponent('transaction_logs').getStore().load(); | ||||||
|  | 
 | ||||||
|  |       if( this.queryById('transaction_logs')){ | ||||||
|  |         this.queryById('transaction_logs').enable(); | ||||||
|  |       } | ||||||
|     }, this); |     }, this); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -5,10 +5,18 @@ | |||||||
| 
 | 
 | ||||||
|     // setting the 'rowclick' event
 |     // setting the 'rowclick' event
 | ||||||
|     var view = this.getComponent('user_transactions').getView(); |     var view = this.getComponent('user_transactions').getView(); | ||||||
|  | 
 | ||||||
|  |     if( this.queryById('transaction_logs')){ | ||||||
|  |       this.queryById('transaction_logs').disable(); | ||||||
|  |     } | ||||||
|     view.on('itemclick', function(view, record){ |     view.on('itemclick', function(view, record){ | ||||||
|       // The beauty of using Ext.Direct: calling 3 endpoints in a row, which results in a single call to the server!
 |       // The beauty of using Ext.Direct: calling 3 endpoints in a row, which results in a single call to the server!
 | ||||||
|       this.selectTransaction({transaction_id: record.get('id')}); |       this.selectTransaction({transaction_id: record.get('id')}); | ||||||
|       this.getComponent('transaction_logs').getStore().load(); |       this.getComponent('transaction_logs').getStore().load(); | ||||||
|  | 
 | ||||||
|  |       if( this.queryById('transaction_logs')){ | ||||||
|  |         this.queryById('transaction_logs').enable(); | ||||||
|  |       } | ||||||
|     }, this); |     }, this); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -6,7 +6,12 @@ | |||||||
|     if (stats != undefined){ |     if (stats != undefined){ | ||||||
|       stats.updateStats(); |       stats.updateStats(); | ||||||
|     } |     } | ||||||
| 
 |     if( this.queryById('user_profiles')){ | ||||||
|  |       this.queryById('user_profiles').disable(); | ||||||
|  |     } | ||||||
|  |     if( this.queryById('user_logs')){ | ||||||
|  |       this.queryById('user_logs').disable(); | ||||||
|  |     } | ||||||
|     // setting the 'rowclick' event
 |     // setting the 'rowclick' event
 | ||||||
|     var view = this.getComponent('users').getView(); |     var view = this.getComponent('users').getView(); | ||||||
|     view.on('itemclick', function(view, record){ |     view.on('itemclick', function(view, record){ | ||||||
| @ -14,6 +19,13 @@ | |||||||
|       this.selectUser({user_id: record.get('id')}); |       this.selectUser({user_id: record.get('id')}); | ||||||
|       this.getComponent('user_profiles').getStore().load(); |       this.getComponent('user_profiles').getStore().load(); | ||||||
|       this.getComponent('user_logs').getStore().load(); |       this.getComponent('user_logs').getStore().load(); | ||||||
|  | 
 | ||||||
|  |       if( this.queryById('user_profiles')){ | ||||||
|  |         this.queryById('user_profiles').enable(); | ||||||
|  |       } | ||||||
|  |       if( this.queryById('user_logs')){ | ||||||
|  |         this.queryById('user_logs').enable(); | ||||||
|  |       } | ||||||
|     }, this); |     }, this); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user