Skip to content

Instantly share code, notes, and snippets.

@rmoura-92
Created June 27, 2013 18:06
Show Gist options
  • Save rmoura-92/5878825 to your computer and use it in GitHub Desktop.
Save rmoura-92/5878825 to your computer and use it in GitHub Desktop.
showHoteis: function() {
var that = this;
// Layout options
this.Navigation.select('hoteis');
this.Section.render();
this.Section.holdBackground();
this.Section.changeHeadingContent('As nossas Sugestões');
this.Section.startLoading();
// Results
this.HoteisColl = new HoteisCollection();
this.SideFormView = new FormView({section: 'hoteis', model:this.HoteisColl});
this.HoteisView = new HoteisView({model:this.HoteisColl});
// Render results within the views
this.SideFormView.render();
this.HoteisColl.fetch({
url: 'GetDestaques?backofficeSiteID=10&destaquesType=96',
success: function(response) {
that.HoteisView.renderDestaque(response);
that.Section.stopLoading();
}
});
this.HoteisColl.on('reset', function(response) {
var obj = _.first(response.toJSON());
var searchId = obj.searchId;
var fileCod = obj.fileCod;
console.log(that.HoteisColl.options);
if(searchId) {
that.navigate('hoteis/'+searchId, {trigger:true});
}
});
this.HoteisColl.on('request', function() {
that.Section.startLoading();
});
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment