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();
},
Czytam tutorial na temat backbone.js tutaj: http://addyosmani.com/blog/building-spas-jquerys-best-friends/
Jakie są podkreślenia? (_index, _photos, _album) Po co ich używać?