Browse Source

Disable sub panels until item clicked

topic-sass
Jason Denney 11 years ago
parent
commit
4a67ebe77e
  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
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);
}

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

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

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

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

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

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

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

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

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