mirror of
https://github.com/fspc/BikeShed-1.git
synced 2025-02-28 08:43:23 -05:00
Altered Bikes view to show a bike's task list.
Need to create a default task list for all bikes.
This commit is contained in:
parent
545c33b953
commit
cd65e34ae1
10
app/components/bike_logs_and_tasks_accordian.rb
Normal file
10
app/components/bike_logs_and_tasks_accordian.rb
Normal file
@ -0,0 +1,10 @@
|
||||
class BikeLogsAndTasksAccordian < Netzke::Basepack::Accordion
|
||||
component :bike_logs
|
||||
component :tasks
|
||||
|
||||
def configure(c)
|
||||
c.prevent_header = true
|
||||
c.items = [ :bike_logs, :tasks ]
|
||||
super
|
||||
end
|
||||
end
|
@ -2,7 +2,7 @@ class BikesBorder < Netzke::Base
|
||||
# Remember regions collapse state and size
|
||||
include Netzke::Basepack::ItemPersistence
|
||||
component :bikes
|
||||
component :bike_logs
|
||||
component :bike_logs_and_tasks_accordian
|
||||
|
||||
def configure(c)
|
||||
super
|
||||
@ -10,7 +10,7 @@ class BikesBorder < Netzke::Base
|
||||
c.title = "Bikes"
|
||||
c.items = [
|
||||
{ netzke_component: :bikes, region: :center, split: true },
|
||||
{ netzke_component: :bike_logs, region: :south, height: 300, split: true}
|
||||
{ netzke_component: :bike_logs_and_tasks_accordian, region: :south, height: 300, split: true}
|
||||
]
|
||||
end
|
||||
|
||||
|
@ -8,7 +8,12 @@
|
||||
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')});
|
||||
this.getComponent('bike_logs').getStore().load();
|
||||
if( this.queryById('bike_logs') ){
|
||||
this.queryById('bike_logs').getStore().load();
|
||||
}
|
||||
if( this.queryById('tasks') ){
|
||||
this.queryById('tasks').getStore().load();
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
|
19
app/components/tasks.rb
Normal file
19
app/components/tasks.rb
Normal file
@ -0,0 +1,19 @@
|
||||
class Tasks < Netzke::Basepack::Grid
|
||||
def configure(c)
|
||||
super
|
||||
c.model = "Task"
|
||||
c.scope = lambda{ |rel|
|
||||
if session[:selected_bike_id]
|
||||
rel.where(:task_list_id => Bike.find_by_id(session[:selected_bike_id]).task_list.id)
|
||||
else
|
||||
#show nothing, whatever this works
|
||||
rel.where(:task_list_id => 0)
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
#override with nil to remove actions
|
||||
def default_bbar
|
||||
[ :apply, :add_in_form]
|
||||
end
|
||||
end
|
@ -6,7 +6,6 @@
|
||||
|
||||
var store = this.getComponent('user_logs').getStore()
|
||||
store.on('load', function (store, records, operation, success){
|
||||
console.log("Bitches");
|
||||
this.getComponent('user_stats').updateStats();
|
||||
}, this);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user