Skip to content

Commit

Permalink
work
Browse files Browse the repository at this point in the history
  • Loading branch information
ronreiter committed Jun 24, 2012
1 parent f7e77d8 commit 4b6bfe1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 6 additions & 0 deletions js/main.js
Expand Up @@ -30,6 +30,12 @@ var AppRouter = Backbone.Router.extend({
},

beerDetails: function (id) {
if (!beers.models.length) {
this.navigate("", false);

return;
}

$("#content").html(new BeerView({ model: beers.get(id) }).el);
this.headerView.selectMenuItem();
},
Expand Down
6 changes: 2 additions & 4 deletions js/views/beerdetails.js
Expand Up @@ -26,7 +26,6 @@ window.BeerView = Backbone.View.extend({
});

google.maps.event.addListener(marker, "dragend", _.bind(function() {
debugger;
this.model.set("latitude", marker.getPosition().lat());
this.model.set("longitude", marker.getPosition().lng());
}, this));
Expand Down Expand Up @@ -85,7 +84,7 @@ window.BeerView = Backbone.View.extend({
this.model.save(null, {
success: function (model) {
self.render();
app.navigate('/', false);
app.navigate('', false);
utils.showAlert('Success!', 'Beer details were saved successfully.', 'alert-success');

},
Expand All @@ -98,7 +97,7 @@ window.BeerView = Backbone.View.extend({
deleteBeer: function () {
this.model.destroy({
success: function () {
app.navigate("/", false);
app.navigate("", false);
}
});
return false;
Expand All @@ -116,7 +115,6 @@ window.BeerView = Backbone.View.extend({
reader.onloadend = _.bind(function () {
this.image.attr('src', reader.result);
this.model.set("image", { value : reader.result });
debugger;
}, this);

reader.readAsDataURL(this.pictureFile);
Expand Down

0 comments on commit 4b6bfe1

Please sign in to comment.