mirror of
				https://github.com/fspc/BikeShed-1.git
				synced 2025-10-31 08:55:36 -04:00 
			
		
		
		
	Merge pull request #93 from spacemunkay/denney-disable-subpanels
Disable sub panels until item clicked
This commit is contained in:
		
						commit
						3ba443397e
					
				| @ -5,14 +5,30 @@ | ||||
| 
 | ||||
|     // setting the 'rowclick' event
 | ||||
|     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){ | ||||
|       // 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')}); | ||||
|       if( this.queryById('bike_logs') ){ | ||||
|         this.queryById('bike_logs').getStore().load(); | ||||
|       // query for these components again, can change if not visible because of accordian
 | ||||
|       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') ){ | ||||
|         this.queryById('tasks').getStore().load(); | ||||
|       if( bike_tasks_comp ){ | ||||
|         bike_tasks_comp.getStore().load(); | ||||
|         bike_tasks_comp.enable(); | ||||
|       } | ||||
|     }, this); | ||||
|   } | ||||
|  | ||||
| @ -4,7 +4,6 @@ | ||||
|     this.callParent(); | ||||
|     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!
 | ||||
|       console.log("user: " + record.get('id') ); | ||||
|       this.selectCustomer({customer_id: record.get('id'), customer_type: 'Customer'}); | ||||
|     }, this); | ||||
|   } | ||||
|  | ||||
| @ -2,6 +2,8 @@ class Tasks < Netzke::Basepack::Grid | ||||
|   def configure(c) | ||||
|     super | ||||
| 
 | ||||
|     #disable by default, will be enabled once bike is clicked | ||||
|     c.disabled = true | ||||
|     task_list_id = nil | ||||
|     if session[:selected_bike_id] | ||||
|       task_list_id = Bike.find_by_id(session[:selected_bike_id]).task_list.id | ||||
|  | ||||
| @ -5,10 +5,19 @@ | ||||
| 
 | ||||
|     // setting the 'rowclick' event
 | ||||
|     var view = this.getComponent('transactions').getView(); | ||||
| 
 | ||||
|     if( this.queryById('transaction_logs')){ | ||||
|       this.queryById('transaction_logs').disable(); | ||||
|     } | ||||
| 
 | ||||
|     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!
 | ||||
|       this.selectTransaction({transaction_id: record.get('id')}); | ||||
|       this.getComponent('transaction_logs').getStore().load(); | ||||
| 
 | ||||
|       if( this.queryById('transaction_logs')){ | ||||
|         this.queryById('transaction_logs').enable(); | ||||
|       } | ||||
|     }, this); | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -5,10 +5,18 @@ | ||||
| 
 | ||||
|     // setting the 'rowclick' event
 | ||||
|     var view = this.getComponent('user_transactions').getView(); | ||||
| 
 | ||||
|     if( this.queryById('transaction_logs')){ | ||||
|       this.queryById('transaction_logs').disable(); | ||||
|     } | ||||
|     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!
 | ||||
|       this.selectTransaction({transaction_id: record.get('id')}); | ||||
|       this.getComponent('transaction_logs').getStore().load(); | ||||
| 
 | ||||
|       if( this.queryById('transaction_logs')){ | ||||
|         this.queryById('transaction_logs').enable(); | ||||
|       } | ||||
|     }, this); | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -6,7 +6,12 @@ | ||||
|     if (stats != undefined){ | ||||
|       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
 | ||||
|     var view = this.getComponent('users').getView(); | ||||
|     view.on('itemclick', function(view, record){ | ||||
| @ -14,6 +19,13 @@ | ||||
|       this.selectUser({user_id: record.get('id')}); | ||||
|       this.getComponent('user_profiles').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); | ||||
|   } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user