Skip to content

Commit

Permalink
Merge branch 'section_10_4' into section_10_5
Browse files Browse the repository at this point in the history
  • Loading branch information
Noel Rappin committed Nov 25, 2012
2 parents 134be37 + 293bd40 commit 81eecd6
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/backbone/routers/tripRouter.js
Expand Up @@ -2,7 +2,7 @@ TimeTravel.Routers.TripRouter = Backbone.Router.extend({
//##routes
routes: {
"": "index",
"trips/:id": "tripDetail",
"trips/detail/:id": "tripDetail",
},
//##routes

Expand Down
@@ -1,7 +1,5 @@
<div class="trip_header">
<a href="/trips/{{id}}"
class="detail_page_link"
id="detail_page_link_{{id}}">{{name}}</a>
<a href="/trips/detail/{{id}}" class="detail_page_link">{{name}}</a>
</div>
<div class="trip_tag">{{tag_line}}</div>
<div class="trip_dates">{{startDateDisplay}} - {{endDateDisplay}}</div>
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/backbone/views/tripView.js
Expand Up @@ -30,7 +30,7 @@ TimeTravel.Views.TripView = Backbone.View.extend({
//##go
goToDetailPage: function(event) {
event.preventDefault();
TimeTravel.app.navigate("trips/" + this.model.get("id"), true);
TimeTravel.app.navigate("trips/detail/" + this.model.get("id"), true);
},
//##go

Expand Down
1 change: 1 addition & 0 deletions app/assets/javascripts/backbone/views/tripsView.js
Expand Up @@ -7,6 +7,7 @@ TimeTravel.Views.TripsView = Backbone.View.extend({
this.collection.bind('reset', this.render, this);
},

//##renderWith
render: function() {
this.$el.html(TimeTravel.template('tripsViewTemplate').render());
var $trips = this.$('.trips');
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Expand Up @@ -18,6 +18,7 @@
resources :users

root :to => 'home#index'
match "trips/detail/:id" => 'home#index'

#START: code.index_route
match 'index' => 'home#index'
Expand Down
2 changes: 1 addition & 1 deletion spec/javascripts/homePageSpec.js
Expand Up @@ -35,7 +35,7 @@ describe("rendering the home page with Backbone", function() {
spyOn(TimeTravel.app, 'navigate');
TimeTravel.app.index();
$("#detail_page_link_13").click();
expect(TimeTravel.app.navigate).toHaveBeenCalledWith('trips/13', true);
expect(TimeTravel.app.navigate).toHaveBeenCalledWith('trips/detail/13', true);
});

});
Expand Down

0 comments on commit 81eecd6

Please sign in to comment.