var Gallery = Backbone.Controller.extend({
_index: null,
_photos: null,
_album :null,
_subalbums:null,
_subphotos:null,
_data:null,
_photosview:null,
_currentsub:null,
routes: {
"": "index",
"subalbum/:id": "subindex",
"subalbum/:id/" : "directphoto",
"subalbum/:id/:num" : "hashphoto"
},
initialize: function(options) {
var ws = this;
if (this._index === null){
$.ajax({
url: 'data/album1.json',
dataType: 'json',
data: {},
success: function(data) {
ws._data = data;
ws._photos =
new PhotoCollection(data);
ws._index =
new IndexView({model: ws._photos});
Backbone.history.loadUrl();
}
});
return this;
}
return this;
},
//Handle rendering the initial view for the
//application
index: function() {
this._index.render();
},
Sto leggendo un tutorial su backbone.js qui: http://addyosmani.com/blog/building-spas-jquerys-best-friends/
Quali sono le sottolineature? (_index, _photos, _album) Perché usarli?