Browse Source

Merge pull request #93 from spacemunkay/denney-disable-subpanels

Disable sub panels until item clicked
topic-sass
Jason Denney 11 years ago
parent
commit
3ba443397e
  1. 24
      app/components/bikes_border/javascripts/init_component.js
  2. 1
      app/components/customers/javascripts/init_component.js
  3. 2
      app/components/tasks.rb
  4. 9
      app/components/transactions_border/javascripts/init_component.js
  5. 8
      app/components/user_transactions_border/javascripts/init_component.js
  6. 14
      app/components/users_and_profiles_border/javascripts/init_component.js

24
app/components/bikes_border/javascripts/init_component.js

@ -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);
} }

1
app/components/customers/javascripts/init_component.js

@ -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
app/components/tasks.rb

@ -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

9
app/components/transactions_border/javascripts/init_component.js

@ -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);
} }
} }

8
app/components/user_transactions_border/javascripts/init_component.js

@ -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);
} }
} }

14
app/components/users_and_profiles_border/javascripts/init_component.js

@ -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…
Cancel
Save