Skip to content

Instantly share code, notes, and snippets.

@amysimmons
Last active August 29, 2015 14:20
Show Gist options
  • Select an option

  • Save amysimmons/30a764e7ac0cb4543eaf to your computer and use it in GitHub Desktop.

Select an option

Save amysimmons/30a764e7ac0cb4543eaf to your computer and use it in GitHub Desktop.
LevelUp Backbone Overview

#LevelUp Backbone Overview

Backbone gives us structure to our code

It has views, models, a router and the html

When dealing with code that works with data, we will deal with the model

When dealing with the logic for each page in the application, we will deal with the view

Navigation will go in the router

The HTML matches the Handlebars templates

Every model should have a corresponding file containing tests

Every view should have a corresponding file containing tests

Important points:

  • The router is where you setup navigation
  • The views contain the logic for the page
  • We use buttonEvents in views to configure the watch buttons on a page
  • The router models views and collections each have their own spec

##Demo: TDD a new page in the watch app##

The main folder to look at is the client folder

The spec files live in the spec directory, the other files live in the src directory

The steps:

Add a new route to router.js file

Add a new render method below

Move to the pages directory, make a new page and copy the skeleton of an existing one

Lastly, make a template to go with the new page

Go back to the home page and specify which button will go to the new page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment