Skip to content

Commit

Permalink
fixing issue reported where direct linking to level 3 doesnt remove f…
Browse files Browse the repository at this point in the history
…allbacks
  • Loading branch information
addyosmani committed Feb 23, 2011
1 parent 4c9a295 commit a3f51f7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions gallery.js
Expand Up @@ -25,6 +25,13 @@ var PhotoCollection = Backbone.Collection.extend({
}
});

function removeFallbacks(){
var query = $('.jstest,.gallery');
if(query.length){
query.remove();
}
}


/**
* IndexView: The default view seen when opening up the application for the first time. This
Expand All @@ -38,7 +45,7 @@ var IndexView = Backbone.View.extend({
indexTemplate: $("#indexTmpl").template(),

render: function() {
$('.jstest,.gallery').remove();
removeFallbacks();
var sg = this;

this.el.fadeOut('fast', function() {
Expand Down Expand Up @@ -68,7 +75,7 @@ var SubalbumView = Backbone.View.extend({

render: function() {
var sg = this;

removeFallbacks();
this.el.fadeOut('fast', function() {
sg.el.empty();
$.tmpl(sg.indexTemplate, sg.model.toArray()).appendTo(sg.el);
Expand Down Expand Up @@ -98,7 +105,7 @@ var PhotoView = Backbone.View.extend({

render: function() {
var sg = this;

removeFallbacks();
this.el.fadeOut('fast', function() {
sg.el.empty();
$.tmpl(sg.itemTemplate, sg.model).appendTo(sg.el);
Expand Down

0 comments on commit a3f51f7

Please sign in to comment.