wheelhouse-router
Version:
A wheelhouse library to marry flatiron's Director with Backbone's router
51 lines (49 loc) • 1.29 kB
JavaScript
;
module.exports = {
index: function(){
return {
view: 'streets/index'
, collection: 'streets'
, data: function(collection){
return {streets: collection.toJSON()}
}
, bootstrap: function(collection){
return collection.toJSON()
}
}
}
, detail: function(street){
return {
view: 'streets/detail'
, collection: 'streets'
, model: function(collection){
return collection.get(street)
}
, data: function(collection){
var model = collection.findWhere({name: street})
return model ? model.toJSON() : {}
}
, bootstrap: function(collection){
var model = collection.findWhere({name: street})
return model ? model.toJSON() : null
}
}
}
, edit: function(street){
return {
view: 'streets/edit'
, collection: 'streets'
, model: function(collection){
return collection.get(street)
}
, data: function(collection){
var model = collection.findWhere({name: street})
return model ? model.toJSON() : {}
}
, bootstrap: function(collection){
var model = collection.findWhere({name: street})
return model ? model.toJSON() : null
}
}
}
}