SlideShare uma empresa Scribd logo
1 de 168
BACKBONE JS
       { Journey to the Front End }




Brian Mann
@backbonerails
BackboneRails.com
MY
    EXPERIENCE
WITH BACKBONE
A Little Perspective

 • Web Application Developer
     ‣ Backbone / Ruby on Rails

 • Scaling Our Project
     ‣ Totals about 600 JS files
     ‣ Close to 80 different JS modules
     ‣ 120+ server models
     ‣ Entirely Single Page

 • Published Screencasts
     ‣ Chronicles development patterns


Backbone JS: Journey to the Front End    BACKBONERAILS.com
BACKBONE IN A NUTSHELL
Key Points

 • Introduces the building blocks of MVC frameworks
 • Manages the complexity of front end logic
 • Provides the structural components for organizing
     ‣ Presentation
     ‣ Behavior
     ‣ Implementation

 • Keeps view changes in sync
 • Eliminates unmanageable spaghetti code

Backbone JS: Journey to the Front End          BACKBONERAILS.com
Tenets of Backbone

 • Powered by RESTful JSON API
 • Low Profile
     ‣ Unopinionated
     ‣ Leaves implementation up to the developer

 • Small Set of Documentation
 • Huge Success Record
     ‣ Major players using it in production

 • Awesome Community Support


Backbone JS: Journey to the Front End              BACKBONERAILS.com
SHOW DON’T TELL
Pandora   Google Analytics




WuFoo          Rdio
Google Analytics




1. Loading feedback while fetching data from server
Google Analytics




1. Loading feedback while fetching data from server
Google Analytics




2. Dialog Selection Events
Google Analytics




2. Dialog Selection Events
WuFoo




1. Picked up and dragged “Single Line Text”
WuFoo




1. Picked up and dragged “Single Line Text”
WuFoo




2. Passively saved to server, displayed single line text
WuFoo




2. Passively saved to server, displayed single line text
WuFoo




3. Two Way Data Binding
WuFoo




3. Two Way Data Binding
WuFoo




4. Immediate Selection Feedback
WuFoo




4. Immediate Selection Feedback
Rdio




1. Changing sort order - hovered over “Song” drop down
Rdio




1. Changing sort order - hovered over “Song” drop down
Rdio




2. Clicking “Artist” to sort songs by Artist
Rdio




2. Clicking “Artist” to sort songs by Artist
Rdio




3. Shows loading spinner while fetching new data
Rdio




3. Shows loading spinner while fetching new data
Rdio




4. New collection is shown, URL is updated
Rdio




4. New collection is shown, URL is updated
EVOLUTION OF THE WEB
http://www.serversrule.com/




   before 2005




Stateless Servers
http://www.serversrule.com/



      <html>
           <head>
               <title>Best Page in the Universe</title>
           </head>
           <body>
               <div id="header">
                   <ul>
                        <li>
                             <a href="link1">Link 1</a>
                        </li>
                        <li>
                             <a href="link2">Link 2</a>
                        </li>
                        <li>
                             <a href="link3">Link 3</a>
                        </li>
                   </ul>
   before 2005 </div>
               <div id="main">Home Page Content</div>
           </body>
      </html>



Stateless Servers
http://www.serversrule.com/




   My Awesome Site                   Link 1 | Link 2 | Link 3




                            Home Page




   before 2005




Stateless Servers
http://www.serversrule.com/




   My Awesome Site                   Link 1 | Link 2 | Link 3




                            Home Page




   before 2005




Stateless Servers
http://www.serversrule.com/link1




   My Awesome Site                        Link 1 | Link 2 | Link 3




                            Home Page




   before 2005




Stateless Servers
http://www.serversrule.com/link1




   before 2005




Stateless Servers
http://www.serversrule.com/link1



      <html>
           <head>
               <title>Best Page in the Universe</title>
           </head>
           <body>
               <div id="header">
                   <ul>
                        <li class="active">
                             <a href="link1">Link 1</a>
                        </li>
                        <li>
                             <a href="link2">Link 2</a>
                        </li>
                        <li>
                             <a href="link3">Link 3</a>
                        </li>
                   </ul>
   before 2005 </div>
               <div id="main">Link 1 - Content</div>
           </body>
      </html>



Stateless Servers
http://www.serversrule.com/link1



      <html>
           <head>
               <title>Best Page in the Universe</title>
           </head>
           <body>
               <div id="header">
                   <ul>
                        <li class="active">
                             <a href="link1">Link 1</a>
                        </li>
                        <li>
                             <a href="link2">Link 2</a>
                        </li>
                        <li>
                             <a href="link3">Link 3</a>
                        </li>
                   </ul>
   before 2005 </div>
               <div id="main">Link 1 - Content</div>
           </body>
      </html>



Stateless Servers
http://www.serversrule.com/link1




   My Awesome Site                        Link 1 | Link 2 | Link 3




                        Link 1 - Content




   before 2005




Stateless Servers
http://www.serversrule.com/link1




   My Awesome Site                        Link 1 | Link 2 | Link 3




                        Link 1 - Content




   before 2005




Stateless Servers
http://www.serversrule.com/link1




   My Awesome Site                        Link 1 | Link 2 | Link 3




                        Link 1 - Content




   before 2005                  2006 - 2009




Stateless Servers            Heavy AJAX Use
http://www.serversrule.com/link1




   My Awesome Site                        Link 1 | Link 2 | Link 3




                        Link 1 - Content




   before 2005                  2006 - 2009




Stateless Servers            Heavy AJAX Use
http://www.serversrule.com/link1



      <html>
   My Awesome Site
           <head>                     Link 1 | Link 2 | Link 3
               <title>Best Page in the Universe</title>
           </head>
           <body>
               <div id="header">
                   <ul>
                        <li class="active">

                         Link 1 - Content
                        </li>
                             <a href="link1">Link 1</a>

                        <li>
                             <a href="link2">Link 2</a>
                        </li>
                        <li>
                             <a href="link3">Link 3</a>
                        </li>
                   </ul>
   before 2005 </div>      2006 - 2009
               <div id="main">Link 1 - Content</div>
           </body>
      </html>



Stateless Servers             Heavy AJAX Use
http://www.serversrule.com/link1



      <html>
   My Awesome Site
           <head>                     Link 1 | Link 2 | Link 3
               <title>Best Page in the Universe</title>
           </head>
           <body>
               <div id="header">
                   <ul>
                        <li class="active">

                         Link 1 - Content
                        </li>
                             <a href="link1">Link 1</a>

                        <li>
                             <a href="link2">Link 2</a>
                        </li>
                        <li>
                             <a href="link3">Link 3</a>
                        </li>
                   </ul>
   before 2005 </div>      2006 - 2009
               <div id="main">Link 1 - Content</div>
           </body>
      </html>



Stateless Servers             Heavy AJAX Use
http://www.serversrule.com/link1



      <html>
   My Awesome Site
           <head>                     Link 1 | Link 2 | Link 3
               <title>Best Page in the Universe</title>
           </head>
           <body>
               <div id="header">
                   <ul>
                        <li class="active">

                         Link 1 - Content
                        </li>
                             <a href="link1">Link 1</a>

                        <li>
                             <a href="link2">Link 2</a>
                        </li>
                        <li>
                             <a href="link3">Link 3</a>
                        </li>
                   </ul>
   before 2005 </div>      2006 - 2009
               <div id="main">                  </div>
           </body>
      </html>



Stateless Servers             Heavy AJAX Use
http://www.serversrule.com/link1



      <html>
   My Awesome Site
           <head>                     Link 1 | Link 2 | Link 3
               <title>Best Page in the Universe</title>
           </head>
           <body>
               <div id="header">
                   <ul>
                        <li class="active">

                         Link 1 - Content
                        </li>
                             <a href="link1">Link 1</a>

                        <li>
                             <a href="link2">Link 2</a>
                        </li>
                        <li>
                             <a href="link3">Link 3</a>
                        </li>
                   </ul>
   before 2005 </div>      2006 - 2009
               <div id="main">Link 2 - Content</div>
           </body>
      </html>



Stateless Servers             Heavy AJAX Use
http://www.serversrule.com/link1



      <html>
   My Awesome Site
           <head>                     Link 1 | Link 2 | Link 3
               <title>Best Page in the Universe</title>
           </head>
           <body>
               <div id="header">
                   <ul>
                        <li class="active">

                         Link 1 - Content
                        </li>
                             <a href="link1">Link 1</a>

                        <li>
                             <a href="link2">Link 2</a>
                        </li>
                        <li>
                             <a href="link3">Link 3</a>
                        </li>
                   </ul>
   before 2005 </div>      2006 - 2009
               <div id="main">Link 2 - Content</div>
           </body>
      </html>



Stateless Servers             Heavy AJAX Use
http://www.serversrule.com/link1



      <html>
   My Awesome Site
          <head>                   Link 1 | Link 2 | Link 3
              <title>Best Page in the Universe</title>
          </head>
          <body>
              <div id="header">
                  <ul>


                        Link <a - Content 1</a>
                              1 href="link1">Link
                          </li>
                       <li>
                            <a href="link2">Link 2</a>
                       </li>
                       <li>
                            <a href="link3">Link 3</a>
                       </li>
                   </ul>
   before 2005 </div>     2006 - 2009
               <div id="main">Link 2 - Content</div>
           </body>
      </html>



Stateless Servers            Heavy AJAX Use
http://www.serversrule.com/link1



      <html>
   My Awesome Site
           <head>                     Link 1 | Link 2 | Link 3
               <title>Best Page in the Universe</title>
           </head>
           <body>
               <div id="header">
                   <ul>
                        <li>

                         Link 1 - Content
                        </li>
                             <a href="link1">Link 1</a>

                        <li>
                             <a href="link2">Link 2</a>
                        </li>
                        <li>
                             <a href="link3">Link 3</a>
                        </li>
                   </ul>
   before 2005 </div>      2006 - 2009
               <div id="main">Link 2 - Content</div>
           </body>
      </html>



Stateless Servers             Heavy AJAX Use
http://www.serversrule.com/link1



      <html>
   My Awesome Site
           <head>                     Link 1 | Link 2 | Link 3
               <title>Best Page in the Universe</title>
           </head>
           <body>
               <div id="header">
                   <ul>
                        <li>

                         Link 1 - Content
                        </li>
                             <a href="link1">Link 1</a>

                        <li>
                             <a href="link2">Link 2</a>
                        </li>
                        <li>
                             <a href="link3">Link 3</a>
                        </li>
                   </ul>
   before 2005 </div>      2006 - 2009
               <div id="main">Link 2 - Content</div>
           </body>
      </html>



Stateless Servers             Heavy AJAX Use
http://www.serversrule.com/link1



      <html>
   My Awesome Site
          <head>                    Link 1 | Link 2 | Link 3
              <title>Best Page in the Universe</title>
          </head>
          <body>
              <div id="header">
                  <ul>
                       <li>

                        Link 1 - Content
                           <a href="link1">Link 1</a>
                       </li>

                            <a href="link2">Link 2</a>
                       </li>
                       <li>
                            <a href="link3">Link 3</a>
                       </li>
                   </ul>
   before 2005 </div>     2006 - 2009
               <div id="main">Link 2 - Content</div>
           </body>
      </html>



Stateless Servers            Heavy AJAX Use
http://www.serversrule.com/link1



      <html>
   My Awesome Site
           <head>                     Link 1 | Link 2 | Link 3
               <title>Best Page in the Universe</title>
           </head>
           <body>
               <div id="header">
                   <ul>
                        <li>

                         Link 1 - Content
                        </li>
                             <a href="link1">Link 1</a>

                        <li class="active">
                             <a href="link2">Link 2</a>
                        </li>
                        <li>
                             <a href="link3">Link 3</a>
                        </li>
                   </ul>
   before 2005 </div>      2006 - 2009
               <div id="main">Link 2 - Content</div>
           </body>
      </html>



Stateless Servers             Heavy AJAX Use
http://www.serversrule.com/link1




   My Awesome Site                        Link 1 | Link 2 | Link 3




                        Link 1 - Content




   before 2005                  2006 - 2009




Stateless Servers            Heavy AJAX Use
http://www.serversrule.com/link1




   My Awesome Site                        Link 1 | Link 2 | Link 3




                        Link 2 - Content




   before 2005                  2006 - 2009




Stateless Servers            Heavy AJAX Use
http://www.serversrule.com/link1




   My Awesome Site                        Link 1 | Link 2 | Link 3




                        Link 2 - Content




   before 2005                  2006 - 2009




Stateless Servers            Heavy AJAX Use
http://www.serversrule.com/link1




   My Awesome Site                        Link 1 | Link 2 | Link 3




                        Link 2 - Content




   before 2005                  2006 - 2009            2010 - now




Stateless Servers            Heavy AJAX Use           Modern MVC
http://www.serversrule.com/link1




            My Awesome Site                        Link 1 | Link 2 | Link 3
<Links Collection>
Models:
[
  {name: “Link1”, active: false},
  {name: “Link2”, active: true},

]                        Link 2 - Content
  {name: “Link3”, active: false}




            before 2005                  2006 - 2009            2010 - now




         Stateless Servers            Heavy AJAX Use           Modern MVC
http://www.serversrule.com/link1




            My Awesome Site                        Link 1 | Link 2 | Link 3
<Links Collection>
Models:
[
  {name: “Link1”, active: false},
  {name: “Link2”, active: true},     Object { ... type=”click” .. }

]                        Link 2 - Content
  {name: “Link3”, active: false}




            before 2005                  2006 - 2009            2010 - now




         Stateless Servers            Heavy AJAX Use           Modern MVC
http://www.serversrule.com/link1




              My Awesome Site                        Link 1 | Link 2 | Link 3
<Links Collection>
Models:           1. Capture event, prevent default action
[
  {name: “Link1”, 2. Call method on model to set {active: true}
                   active: false},
  {name: “Link2”, active: true},             Object { ... type=”click” .. }
  {name: “Link3”, 3. Fires event which causes previously
]                            Link 2 - Content
                   active: false}
                     selected <li> to deselect itself - and
                        current <li> to select itself
                        <li class=”active”>...</li>

                    4. Let our managing controller know this
                       click event has occurred
              before 2005                  2006 - 2009            2010 - now
                    5. Controller decides what the next action
                       should be


           Stateless Servers            Heavy AJAX Use           Modern MVC
Backbone Components

 • Entities
     ‣ Models
     ‣ Collections




Backbone JS: Journey to the Front End   BACKBONERAILS.com
Backbone Components

 • Entities
         Model
     ‣ Models
     ‣ Collections
           User

 firstName: Brian
 lastName: Mann

 fullName()
 save()




Backbone JS: Journey to the Front End   BACKBONERAILS.com
Backbone Components

 • Entities
         Model
     ‣ Models
     ‣ Collections
           User

 firstName: Brian
 lastName: Mann

 fullName()
 save()




Backbone JS: Journey to the Front End   BACKBONERAILS.com
Backbone Components

 • Entities
         Model
     ‣ Models
     ‣ Collections
           User

 firstName: Brian
 lastName: Mann

 fullName()
 save()




Backbone JS: Journey to the Front End   BACKBONERAILS.com
Backbone Components

 • Entities                                                Events
         Model
     ‣ Models
                                            Name       When This Event Triggers
     ‣ Collections
           User                             change     when any model attributes have changed


 firstName: Brian                 change:[attribute]   when a specific attribute has changed
 lastName: Mann
                                            destroy    when a model is destroyed

 fullName()                                    sync
                                                       when a model has successfully synced with
 save()                                                the server

                                               error   when a model’s save call fails on the server

                                                       when a models validations fails on the
                                             invalid
                                                       client




Backbone JS: Journey to the Front End                             BACKBONERAILS.com
Backbone Components

 • Entities
   Collection
    ‣ Models
     ‣ Collections
          User                          User         User




          User                          User         User




Backbone JS: Journey to the Front End          BACKBONERAILS.com
Backbone Components

 • Entities
   Collection
    ‣ Models                                        Events
     ‣ Collections
                                        Name      When This Event Triggers
          User                          User                                 User
                                           add    when a model is added to the collection


                                        remove    when a model is removed from a collection

                                                  when the collection’s entire contents have
                                          reset
                                                  been replaced

          User                          User
                                         sort                                User
                                                  when the collection has been re-sorted

                                                  when a collection has started to request to
                                        request
                                                  the server
                                                  when a collection has been successfully
                                          sync
                                                  synced with the server



Backbone JS: Journey to the Front End                             BACKBONERAILS.com
Backbone Components

 • Entities
     ‣ Models
     ‣ Collections

 • Views
     ‣ usually paired with a model or collection
     ‣ given a template (a chunk of HTML)
     ‣ responsible for rendering + responding to model/collection events




Backbone JS: Journey to the Front End                BACKBONERAILS.com
Backbone Components

 • Entities
     ‣ Models
     ‣ Collections

 • Views
     ‣ usually paired with a model or collection
     ‣ given a template (a chunk of HTML)
     ‣ responsible for rendering + responding to model/collection events

 • Routers
     ‣ listen for and react to client side URLs




Backbone JS: Journey to the Front End                BACKBONERAILS.com
Backbone Components

 • Entities     http://www.app.com/#users

     ‣ Models
     ‣ Collections

 • Views
     ‣ usually paired with a model or collection
                                    Z
     ‣ given a template (a chunk of HTML)
     ‣ responsible for rendering + responding to model/collection events

 • Routers
     ‣ listen for and react to client side URLs




Backbone JS: Journey to the Front End                BACKBONERAILS.com
Backbone Components

 • Entities
     ‣ Models
     ‣ Collections

 • Views
     ‣ usually paired with a model or collection
     ‣ given a template (a chunk of HTML)
     ‣ responsible for rendering + responding to model/collection events

 • Routers
     ‣ listen for and react to client side URLs

 • Events

Backbone JS: Journey to the Front End                BACKBONERAILS.com
RELATIONSHIP BETWEEN
     VIEWS AND MODELS
http://www.app.com/#users/1/edit



Hi, Stanley Kubrick                                  Edit Profile

             Name       Stanley Kubrick

               Age      70

            Gender      male        female

             Email      stanley.kubrick@mgm.com

            Friends   1. Malcolm McDowell     x
                      2. Arthur C. Clarke x
                      3. Peter Sellers x

                        add new friend...               +




                                cancel        Save
http://www.app.com/#users/1/edit



Hi, Stanley Kubrick                                  Edit Profile

             Name       Stanley Kubrick

               Age      70   View
            Gender      male        female

             Email      stanley.kubrick@mgm.com

            Friends   1. Malcolm McDowell     x
                      2. Arthur C. Clarke x
                      3. Peter Sellers x

                        add new friend...               +




                                cancel        Save
http://www.app.com/#users/1/edit



Hi, Stanley Kubrick                                  Edit Profile

             Name       Stanley Kubrick

               Age      70   View
            Gender      male        female

             Email      stanley.kubrick@mgm.com

            Friends   1. Malcolm McDowell     x
                      2. Arthur C. Clarke x
                      3. Peter Sellers x
Model                   add new friend...            Template
                                                        +




                                cancel        Save
{
    "id": 1,
    "picture": "images/user_1.png",
    "age": 70,
    "name": "Stanley Kubrick",
    "gender": "male",
    "company": "MGM",
    "phone": "832-547-3983",
    "email": "stanley.kubrick@mgm.com",
    "address": "Hertfordshire England",
    "friends": [
       {
          "id": 1,
          "name": "Malcolm McDowell"
       },
       {
          "id": 2,
          "name": "Arthur C. Clarke"
       },
       {
          "id": 3,
          "name": "Peter Sellers"
       }
    ]
}
{
                                               "id": 1,
                                               "picture": "images/user_1.png",
<div id=”user”>Hi, Stanley Kubrick</div>       "age": 70,
                                               "name": "Stanley Kubrick",
                                               "gender": "male",
                                               "company": "MGM",
                                               "phone": "832-547-3983",
                                               "email": "stanley.kubrick@mgm.com",
                                               "address": "Hertfordshire England",
                                               "friends": [
                                                  {
                                                     "id": 1,
                                                     "name": "Malcolm McDowell"
                                                  },
                                                  {
                                                     "id": 2,
                                                     "name": "Arthur C. Clarke"
                                                  },
                                                  {
                                                     "id": 3,
                                                     "name": "Peter Sellers"
                                                  }
                                               ]
                                           }
{
                                                 "id": 1,
                                                 "picture": "images/user_1.png",
<div id=”user”>Hi, Stanley Kubrick</div>         "age": 70,
                                                 "name": "Stanley Kubrick",
                                                 "gender": "male",
                                                 "company": "MGM",
                                                 "phone": "832-547-3983",
                                                 "email": "stanley.kubrick@mgm.com",
 <a href=”mailto:stanley.kubrick@mgm.com”>
                                                 "address": "Hertfordshire England",
   Email Stanley
                                                 "friends": [
 </a>                                               {
                                                       "id": 1,
                                                       "name": "Malcolm McDowell"
                                                    },
                                                    {
                                                       "id": 2,
                                                       "name": "Arthur C. Clarke"
                                                    },
                                                    {
                                                       "id": 3,
                                                       "name": "Peter Sellers"
                                                    }
                                                 ]
                                             }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Stanley Kubrick</div>             "age": 70,
                                                     "name": "Stanley Kubrick",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
                                                     "email": "stanley.kubrick@mgm.com",
 <a href=”mailto:stanley.kubrick@mgm.com”>
                                                     "address": "Hertfordshire England",
   Email Stanley
                                                     "friends": [
 </a>                                                   {
                                                           "id": 1,
                                                           "name": "Malcolm McDowell"
                                                        },
 <div id=”friends”>                                     {
   <span id=”count”>You have 3 friends:</span>             "id": 2,
   <ul>                                                    "name": "Arthur C. Clarke"
     <li>Malcolm McDowell</li>                          },
     <li>Arthur C. Clarke</li>                          {
     <li>Peter Sellers</li>                                "id": 3,
   </ul>                                                   "name": "Peter Sellers"
 </div>                                                 }
                                                     ]
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Stanley Kubrick</div>             "age": 70,
                                                     "name": "Stanley Kubrick",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
                                                     "email": "stanley.kubrick@mgm.com",
 <a href=”mailto:stanley.kubrick@mgm.com”>
                                                     "address": "Hertfordshire England",
   Email Stanley
                                                     "friends": [
 </a>                                                   {
                                                           "id": 1,
                                                           "name": "Malcolm McDowell"
                                                        },
 <div id=”friends”>                                     {
   <span id=”count”>You have 3 friends:</span>             "id": 2,
   <ul>                                                    "name": "Arthur C. Clarke"
     <li>Malcolm McDowell</li>                          },
     <li>Arthur C. Clarke</li>                          {
     <li>Peter Sellers</li>                                "id": 3,
   </ul>                                                   "name": "Peter Sellers"
 </div>                                                 }
                                                     ]
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Stanley Kubrick</div>             "age": 70,
                                                     "name":
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
                                                     "email": "stanley.kubrick@mgm.com",
 <a href=”mailto:stanley.kubrick@mgm.com”>
                                                     "address": "Hertfordshire England",
   Email Stanley
                                                     "friends": [
 </a>                                                   {
                                                           "id": 1,
                                                           "name": "Malcolm McDowell"
                                                        },
 <div id=”friends”>                                     {
   <span id=”count”>You have 3 friends:</span>             "id": 2,
   <ul>                                                    "name": "Arthur C. Clarke"
     <li>Malcolm McDowell</li>                          },
     <li>Arthur C. Clarke</li>                          {
     <li>Peter Sellers</li>                                "id": 3,
   </ul>                                                   "name": "Peter Sellers"
 </div>                                                 }
                                                     ]
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Stanley Kubrick</div>             "age": 70,
                                                     "name": "Paul Thomas Anderson",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
                                                     "email": "stanley.kubrick@mgm.com",
 <a href=”mailto:stanley.kubrick@mgm.com”>
                                                     "address": "Hertfordshire England",
   Email Stanley
                                                     "friends": [
 </a>                                                   {
                                                           "id": 1,
                                                           "name": "Malcolm McDowell"
                                                        },
 <div id=”friends”>                                     {
   <span id=”count”>You have 3 friends:</span>             "id": 2,
   <ul>                                                    "name": "Arthur C. Clarke"
     <li>Malcolm McDowell</li>                          },
     <li>Arthur C. Clarke</li>                          {
     <li>Peter Sellers</li>                                "id": 3,
   </ul>                                                   "name": "Peter Sellers"
 </div>                                                 }
                                                     ]
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Stanley Kubrick</div>             "age": 70,
                                                     "name": "Paul Thomas Anderson",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
                                                     "email": "stanley.kubrick@mgm.com",
 <a href=”mailto:stanley.kubrick@mgm.com”>
                                                     "address": "Hertfordshire England",
   Email Stanley
                                                     "friends": [
 </a>                                                   {
                                                           "id": 1,
                                                           "name": "Malcolm McDowell"
                                                        },
 <div id=”friends”>                                     {
   <span id=”count”>You have 3 friends:</span>             "id": 2,
   <ul>                                                    "name": "Arthur C. Clarke"
     <li>Malcolm McDowell</li>                          },
     <li>Arthur C. Clarke</li>                          {
     <li>Peter Sellers</li>                                "id": 3,
   </ul>                                                   "name": "Peter Sellers"
 </div>                                                 }
                                                     ]
                                                 }
{
                                                    "id": 1,
                                                    "picture": "images/user_1.png",
                                                    "age": 70,
                                                    "name": "Paul Thomas Anderson",
                                                    "gender": "male",
                                                    "company": "MGM",
                                                    "phone": "832-547-3983",
                                                    "email": "stanley.kubrick@mgm.com",
<a href=”mailto:stanley.kubrick@mgm.com”>
                                                    "address": "Hertfordshire England",
  Email Stanley
                                                    "friends": [
</a>                                                   {
                                                          "id": 1,
                                                          "name": "Malcolm McDowell"
                                                       },
<div id=”friends”>                                     {
  <span id=”count”>You have 3 friends:</span>             "id": 2,
  <ul>                                                    "name": "Arthur C. Clarke"
    <li>Malcolm McDowell</li>                          },
    <li>Arthur C. Clarke</li>                          {
    <li>Peter Sellers</li>                                "id": 3,
  </ul>                                                   "name": "Peter Sellers"
</div>                                                 }
                                                    ]
                                                }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>        "age": 70,
                                                     "name": "Paul Thomas Anderson",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
                                                     "email": "stanley.kubrick@mgm.com",
 <a href=”mailto:stanley.kubrick@mgm.com”>
                                                     "address": "Hertfordshire England",
   Email Stanley
                                                     "friends": [
 </a>                                                   {
                                                           "id": 1,
                                                           "name": "Malcolm McDowell"
                                                        },
 <div id=”friends”>                                     {
   <span id=”count”>You have 3 friends:</span>             "id": 2,
   <ul>                                                    "name": "Arthur C. Clarke"
     <li>Malcolm McDowell</li>                          },
     <li>Arthur C. Clarke</li>                          {
     <li>Peter Sellers</li>                                "id": 3,
   </ul>                                                   "name": "Peter Sellers"
 </div>                                                 }
                                                     ]
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>        "age": 70,
                                                     "name": "Stanley Kubrick",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
                                                     "email": "stanley.kubrick@mgm.com",
 <a href=”mailto:stanley.kubrick@mgm.com”>
                                                     "address": "Hertfordshire England",
   Email Stanley
                                                     "friends": [
 </a>                                                   {
                                                           "id": 1,
                                                           "name": "Malcolm McDowell"
                                                        },
 <div id=”friends”>                                     {
   <span id=”count”>You have 3 friends:</span>             "id": 2,
   <ul>                                                    "name": "Arthur C. Clarke"
     <li>Malcolm McDowell</li>                          },
     <li>Arthur C. Clarke</li>                          {
     <li>Peter Sellers</li>                                "id": 3,
   </ul>                                                   "name": "Peter Sellers"
 </div>                                                 }
                                                     ]
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>        "age": 70,
                                                     "name": "Stanley Kubrick",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
                                                     "email": "stanley.kubrick@mgm.com",
 <a href=”mailto:stanley.kubrick@mgm.com”>
                                                     "address": "Hertfordshire England",
   Email Stanley
                                                     "friends": [
 </a>                                                   {
                                                           "id": 1,
                                                           "name": "Malcolm McDowell"
                                                        },
 <div id=”friends”>                                     {
   <span id=”count”>You have 3 friends:</span>             "id": 2,
   <ul>                                                    "name": "Arthur C. Clarke"
     <li>Malcolm McDowell</li>                          },
     <li>Arthur C. Clarke</li>                          {
     <li>Peter Sellers</li>                                "id": 3,
   </ul>                                                   "name": "Peter Sellers"
 </div>                                                 }
                                                     ]
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>        "age": 70,
                                                     "name": "Stanley Kubrick",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
                                                     "email":
 <a href=”mailto:stanley.kubrick@mgm.com”>
                                                     "address": "Hertfordshire England",
   Email Stanley
                                                     "friends": [
 </a>                                                   {
                                                           "id": 1,
                                                           "name": "Malcolm McDowell"
                                                        },
 <div id=”friends”>                                     {
   <span id=”count”>You have 3 friends:</span>             "id": 2,
   <ul>                                                    "name": "Arthur C. Clarke"
     <li>Malcolm McDowell</li>                          },
     <li>Arthur C. Clarke</li>                          {
     <li>Peter Sellers</li>                                "id": 3,
   </ul>                                                   "name": "Peter Sellers"
 </div>                                                 }
                                                     ]
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>        "age": 70,
                                                     "name": "Stanley Kubrick",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
                                                     "email": "pta@ptanderson.com",
 <a href=”mailto:stanley.kubrick@mgm.com”>
                                                     "address": "Hertfordshire England",
   Email Stanley
                                                     "friends": [
 </a>                                                   {
                                                           "id": 1,
                                                           "name": "Malcolm McDowell"
                                                        },
 <div id=”friends”>                                     {
   <span id=”count”>You have 3 friends:</span>             "id": 2,
   <ul>                                                    "name": "Arthur C. Clarke"
     <li>Malcolm McDowell</li>                          },
     <li>Arthur C. Clarke</li>                          {
     <li>Peter Sellers</li>                                "id": 3,
   </ul>                                                   "name": "Peter Sellers"
 </div>                                                 }
                                                     ]
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>        "age": 70,
                                                     "name": "Stanley Kubrick",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
                                                     "email": "pta@ptanderson.com",
 <a href=”mailto:stanley.kubrick@mgm.com”>
                                                     "address": "Hertfordshire England",
   Email Stanley
                                                     "friends": [
 </a>                                                   {
                                                           "id": 1,
                                                           "name": "Malcolm McDowell"
                                                        },
 <div id=”friends”>                                     {
   <span id=”count”>You have 3 friends:</span>             "id": 2,
   <ul>                                                    "name": "Arthur C. Clarke"
     <li>Malcolm McDowell</li>                          },
     <li>Arthur C. Clarke</li>                          {
     <li>Peter Sellers</li>                                "id": 3,
   </ul>                                                   "name": "Peter Sellers"
 </div>                                                 }
                                                     ]
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>        "age": 70,
                                                     "name": "Stanley Kubrick",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
                                                     "email": "pta@ptanderson.com",
                                                     "address": "Hertfordshire England",
                                                     "friends": [
                                                        {
                                                           "id": 1,
                                                           "name": "Malcolm McDowell"
                                                        },
 <div id=”friends”>                                     {
   <span id=”count”>You have 3 friends:</span>             "id": 2,
   <ul>                                                    "name": "Arthur C. Clarke"
     <li>Malcolm McDowell</li>                          },
     <li>Arthur C. Clarke</li>                          {
     <li>Peter Sellers</li>                                "id": 3,
   </ul>                                                   "name": "Peter Sellers"
 </div>                                                 }
                                                     ]
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>        "age": 70,
                                                     "name": "Stanley Kubrick",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
                                                     "email": "pta@ptanderson.com",
<a href=”mailto:pta@ptanderson.com”>                 "address": "Hertfordshire England",
  Email Paul                                         "friends": [
</a>                                                    {
                                                           "id": 1,
                                                           "name": "Malcolm McDowell"
                                                        },
 <div id=”friends”>                                     {
   <span id=”count”>You have 3 friends:</span>             "id": 2,
   <ul>                                                    "name": "Arthur C. Clarke"
     <li>Malcolm McDowell</li>                          },
     <li>Arthur C. Clarke</li>                          {
     <li>Peter Sellers</li>                                "id": 3,
   </ul>                                                   "name": "Peter Sellers"
 </div>                                                 }
                                                     ]
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>
                                                     "age": 70,
                                                     "name": "Stanley Kubrick",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
<a href=”mailto:pta@ptanderson.com”>                 "email": "stanley.kubrick@mgm.com",
  Email Paul                                         "address": "Hertfordshire England",
                                                     "friends": [
</a>
                                                        {
                                                           "id": 1,
                                                           "name": "Malcolm McDowell"
                                                        },
 <div id=”friends”>                                     {
   <span id=”count”>You have 3 friends:</span>             "id": 2,
   <ul>                                                    "name": "Arthur C. Clarke"
     <li>Malcolm McDowell</li>                          },
     <li>Arthur C. Clarke</li>                          {
     <li>Peter Sellers</li>                                "id": 3,
   </ul>                                                   "name": "Peter Sellers"
 </div>                                                 }
                                                     ]
                                                     ]
                                                 }
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>
                                                     "age": 70,
                                                     "name": "Stanley Kubrick",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
<a href=”mailto:pta@ptanderson.com”>                 "email": "stanley.kubrick@mgm.com",
  Email Paul                                         "address": "Hertfordshire England",
                                                     "friends": [
</a>
                                                        {
                                                           "id": 1,
                                                           "name": "Malcolm McDowell"
                                                        },
 <div id=”friends”>                                     {
   <span id=”count”>You have 3 friends:</span>             "id": 2,
   <ul>                                                    "name": "Arthur C. Clarke"
     <li>Malcolm McDowell</li>                          },
     <li>Arthur C. Clarke</li>                          {
     <li>Peter Sellers</li>                                "id": 3,
   </ul>                                                   "name": "Peter Sellers"
 </div>                                                 }
                                                     ]
                                                     ]
                                                 }
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>
                                                     "age": 70,
                                                     "name": "Stanley Kubrick",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
<a href=”mailto:pta@ptanderson.com”>                 "email": "stanley.kubrick@mgm.com",
  Email Paul                                         "address": "Hertfordshire England",
                                                     "friends": [
</a>
                                                        {
                                                          "id": 1,
                                                          "name": "Malcolm McDowell"
                                                        }
 <div id=”friends”>
   <span id=”count”>You have 3 friends:</span>
   <ul>
     <li>Malcolm McDowell</li>
     <li>Arthur C. Clarke</li>
     <li>Peter Sellers</li>
   </ul>
 </div>
                                                     ]
                                                     ]
                                                 }
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>
                                                     "age": 70,
                                                     "name": "Stanley Kubrick",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
<a href=”mailto:pta@ptanderson.com”>                 "email": "stanley.kubrick@mgm.com",
  Email Paul                                         "address": "Hertfordshire England",
                                                     "friends": [
</a>
                                                        {
                                                          "id": ,
                                                          "name":
                                                        }
 <div id=”friends”>
   <span id=”count”>You have 3 friends:</span>       ]
   <ul>                                          }
     <li>Malcolm McDowell</li>
     <li>Arthur C. Clarke</li>
     <li>Peter Sellers</li>
   </ul>
 </div>

                                                     ]
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>
                                                     "age": 70,
                                                     "name": "Stanley Kubrick",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
<a href=”mailto:pta@ptanderson.com”>                 "email": "stanley.kubrick@mgm.com",
  Email Paul                                         "address": "Hertfordshire England",
                                                     "friends": [
</a>
                                                        {
                                                          "id": 4 ,
                                                          "name": "Daniel Day Lewis"
                                                        }
 <div id=”friends”>
   <span id=”count”>You have 3 friends:</span>       ]
   <ul>                                          }
     <li>Malcolm McDowell</li>
     <li>Arthur C. Clarke</li>
     <li>Peter Sellers</li>
   </ul>
 </div>

                                                     ]
                                                 }
{
                                                     "id": 1,
                                                     "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>
                                                     "age": 70,
                                                     "name": "Stanley Kubrick",
                                                     "gender": "male",
                                                     "company": "MGM",
                                                     "phone": "832-547-3983",
<a href=”mailto:pta@ptanderson.com”>                 "email": "stanley.kubrick@mgm.com",
  Email Paul                                         "address": "Hertfordshire England",
                                                     "friends": [
</a>
                                                        {
                                                          "id": 4 ,
                                                          "name": "Daniel Day Lewis"
                                                        }
 <div id=”friends”>
   <span id=”count”>You have 3 friends:</span>       ]
   <ul>                                          }
     <li>Malcolm McDowell</li>
     <li>Arthur C. Clarke</li>
     <li>Peter Sellers</li>
   </ul>
 </div>

                                                     ]
                                                 }
{
                                                    "id": 1,
                                                    "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>
                                                    "age": 70,
                                                    "name": "Stanley Kubrick",
                                                    "gender": "male",
                                                    "company": "MGM",
                                                    "phone": "832-547-3983",
<a href=”mailto:pta@ptanderson.com”>                "email": "stanley.kubrick@mgm.com",
  Email Paul                                        "address": "Hertfordshire England",
                                                    "friends": [
</a>
                                                       {
                                                         "id": 4 ,
                                                         "name": "Daniel Day Lewis"
                                                       }
                                                    ]
                                                }




                                                    ]
                                                }
{
                                                    "id": 1,
                                                    "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>
                                                    "age": 70,
                                                    "name": "Stanley Kubrick",
                                                    "gender": "male",
                                                    "company": "MGM",
                                                    "phone": "832-547-3983",
<a href=”mailto:pta@ptanderson.com”>                "email": "stanley.kubrick@mgm.com",
  Email Paul                                        "address": "Hertfordshire England",
                                                    "friends": [
</a>
                                                       {
                                                         "id": 4 ,
                                                         "name": "Daniel Day Lewis"
                                                       }
<div id=”friends”>
  <span id=”count”>You have 1 friend:</span>        ]
  <ul>                                          }
    <li>Daniel Day Lewis</li>
  </ul>
</div>



                                                    ]
                                                }
{
                                                    "id": 1,
                                                    "picture": "images/user_1.png",
<div id=”user”>Hi, Paul Thomas Anderson</div>
                                                    "age": 70,
                                                    "name": "Stanley Kubrick",
                                                    "gender": "male",
                                                    "company": "MGM",
                                                    "phone": "832-547-3983",
<a href=”mailto:pta@ptanderson.com”>                "email": "stanley.kubrick@mgm.com",
  Email Paul                                        "address": "Hertfordshire England",
                                                    "friends": [
</a>
                                                       {
                                                         "id": 4 ,
                                                         "name": "Daniel Day Lewis"
                                                       }
<div id=”friends”>
  <span id=”count”>You have 1 friend:</span>        ]
  <ul>                                          }
    <li>Daniel Day Lewis</li>
  </ul>
</div>



                                                    ]
                                                }
BACKBONE IN ACTION
View Layout Container
Title View




             View Layout Container
Title View




             View Layout Container

                  Day Views
Title View                    Time Control View




             View Layout Container

                  Day Views
Title View                       Time Control View

             Chosen Time View




                View Layout Container

                     Day Views
Event
 Calendar                                                        Month
 
 |
 
 Week
 
 |
 
 Day
 -February-
 
      M                 T                          W                                    TH                                                                                F                                                                                           S                                                                                  SU
  1                2                      3                                     4                                                              5                                                                                            6                                                                                          7


 8                 9                     10                                      11                                                         12                                                                                           13                                                                                        14


15                 16                    17                                     18                                                          19                                                                                       20                                                                                             21


 22                23                    24                                     25                                                             26                                                                                          27                                                                                          28
[{
   id: 1,
   name: Doctors Appt,
                            Event
 Calendar                                                        Month
 
 |
 
 Week
 
 |
 
 Day
   where: Dentist,
   date: 02-02-2013,
 -February-
 
   time_start: 2:00pm,
   time_end: 3:00pm             M                 T                          W                                    TH                                                                                F                                                                                           S                                                                                  SU
},{
   id: 2,
   name: Ruby Meetup,
                              1                2                      3                                     4                                                              5                                                                                            6                                                                                          7
   where: Centergy Bld,
   date: 02-13-2013,
   time_start: 7:00pm,

},{
   time_end: 9:00pm
                             8                 9                     10                                      11                                                         12                                                                                           13                                                                                        14
   id: 3,
   name: Buy Flowers!,
   where: null,
   date: 02-14-2013,
   time_start: null,        15                 16                    17                                     18                                                          19                                                                                       20                                                                                             21
   time_end: null
},{
   id: 4,
   name: Visit Vet,
   where: Avian Center,
   date: 02-24-2013,
                             22                23                    24                                     25                                                             26                                                                                          27                                                                                          28
   time_start: 10:00am,
   time_end: 11:00am
}]
[{
   id: 1,
   name: Doctors Appt,
                            Event
 Calendar                                                                                 Month
 
 |
 
 Week
 
 |
 
 Day
   where: Dentist,
   date: 02-02-2013,
 -February-
 
   time_start: 2:00pm,
   time_end: 3:00pm             M                          T                                             W                                        TH                                                                         F                                                                                           S                                                                                  SU
},{
   id: 2,
   name: Ruby Meetup,
                              1                2                                               3                                               4                                                    5                                                                                            6                                                                                          7
   where: Centergy Bld,
                                                Doctors
 
   date: 02-13-2013,                           Appt
   time_start: 7:00pm,

},{
   time_end: 9:00pm
                             8                 9                                              10                                               11                                                12                                                                                           13                                                                                        14
   id: 3,
   name: Buy Flowers!,                                                                                                                                                                                                                                                                          Ruby
                                                     Buy
 
   where: null,                                                                                                                                                                                                                                                                                  Meetup                                                                                  Flowers!
   date: 02-14-2013,
   time_start: null,        15                 16                                             17                                               18                                                19                                                                                       20                                                                                             21
   time_end: null
},{
   id: 4,
   name: Visit Vet,
   where: Avian Center,
   date: 02-24-2013,
                             22                23                                             24                                               25                                                   26                                                                                          27                                                                                          28
   time_start: 10:00am,
   time_end: 11:00am                                                                               Visit
 
}]
                                                                                                      Vet
[{
   id: 1,
   name: Doctors Appt,
                            Event
 Calendar                                                                                 Month
 
 |
 
 Week
 
 |
 
 Day
   where: Dentist,
   date: 02-02-2013,
 -February-
 
   time_start: 2:00pm,
   time_end: 3:00pm             M                          T                                             W                                        TH                                                                         F                                                                                           S                                                                                  SU
},{
   id: 2,
   name: Ruby Meetup,
                              1                2                                               3                                               4                                                    5                                                                                            6                                                                                          7
   where: Centergy Bld,
                                                Doctors
 
   date: 02-13-2013,                           Appt
   time_start: 7:00pm,

},{
   time_end: 9:00pm
                             8                 9                                              10                                               11                                                12                                                                                           13                                                                                        14
   id: 3,
   name: Buy Flowers!,                                                                                                                                                                                                                                                                          Ruby
                                                     Buy
 
   where: null,                                                                                                                                                                                                                                                                                  Meetup                                                                                  Flowers!
   date: 02-14-2013,
   time_start: null,        15                 16                                             17                                               18                                                19                                                                                       20                                                                                             21
   time_end: null
},{
   id: 4,
   name: Visit Vet,
   where: Avian Center,
   date: 02-24-2013,
                             22                23                                             24                                               25                                                   26                                                                                          27                                                                                          28
   time_start: 10:00am,
   time_end: 11:00am                                                                               Visit
 
}]
                                                                                                      Vet
[{
   id: 1,
   name: Doctors Appt,
                            Event
 Calendar                                                                                 Month
 
 |
 
 Week

Mais conteúdo relacionado

Mais procurados

Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
Terry Ryan
 
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Lucidworks
 

Mais procurados (12)

Kindergarten cheat sheet for the wiki2
Kindergarten cheat sheet for the wiki2Kindergarten cheat sheet for the wiki2
Kindergarten cheat sheet for the wiki2
 
HTML5 and the web of tomorrow!
HTML5  and the  web of tomorrow!HTML5  and the  web of tomorrow!
HTML5 and the web of tomorrow!
 
Take Your Markup to 11
Take Your Markup to 11Take Your Markup to 11
Take Your Markup to 11
 
Engineering the New LinkedIn Profile
Engineering the New LinkedIn ProfileEngineering the New LinkedIn Profile
Engineering the New LinkedIn Profile
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
 
What does the browser pre-loader do?
What does the browser pre-loader do?What does the browser pre-loader do?
What does the browser pre-loader do?
 
Html5 Brown Bag
Html5 Brown BagHtml5 Brown Bag
Html5 Brown Bag
 
[In Control 2010] HTML5
[In Control 2010] HTML5[In Control 2010] HTML5
[In Control 2010] HTML5
 
Html5
Html5Html5
Html5
 
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
 
Web Programming - 1st TA Session
Web Programming - 1st TA SessionWeb Programming - 1st TA Session
Web Programming - 1st TA Session
 
ePUB 3 and Publishing e-books
ePUB 3 and Publishing e-booksePUB 3 and Publishing e-books
ePUB 3 and Publishing e-books
 

Destaque (6)

Backbone js-slides
Backbone js-slidesBackbone js-slides
Backbone js-slides
 
симфони это не страшно
симфони   это не страшносимфони   это не страшно
симфони это не страшно
 
Workshop storytelling digital october
Workshop storytelling digital octoberWorkshop storytelling digital october
Workshop storytelling digital october
 
Tikal's Backbone_js introduction workshop
Tikal's Backbone_js introduction workshopTikal's Backbone_js introduction workshop
Tikal's Backbone_js introduction workshop
 
Introduction to backbone js
Introduction to backbone jsIntroduction to backbone js
Introduction to backbone js
 
Backbone js
Backbone jsBackbone js
Backbone js
 

Semelhante a Backbone JS - Journey to the Front End [Dev Nexus Conference]

Darwin web standards
Darwin web standardsDarwin web standards
Darwin web standards
Justin Avery
 
HTML 5 Drupalcamp Ireland Dublin 2010
HTML 5 Drupalcamp Ireland Dublin 2010HTML 5 Drupalcamp Ireland Dublin 2010
HTML 5 Drupalcamp Ireland Dublin 2010
alanburke
 
LIS3353 SP12 Week 4
LIS3353 SP12 Week 4LIS3353 SP12 Week 4
LIS3353 SP12 Week 4
Amanda Case
 

Semelhante a Backbone JS - Journey to the Front End [Dev Nexus Conference] (20)

Practical progressive enhancement
Practical progressive enhancementPractical progressive enhancement
Practical progressive enhancement
 
Darwin web standards
Darwin web standardsDarwin web standards
Darwin web standards
 
HTML 5 Drupalcamp Ireland Dublin 2010
HTML 5 Drupalcamp Ireland Dublin 2010HTML 5 Drupalcamp Ireland Dublin 2010
HTML 5 Drupalcamp Ireland Dublin 2010
 
Beginning Html 5 Presentation
Beginning Html 5 PresentationBeginning Html 5 Presentation
Beginning Html 5 Presentation
 
Liquibase via maven
Liquibase via mavenLiquibase via maven
Liquibase via maven
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
Lesson 3: Linking It All Together
Lesson 3: Linking It All Together Lesson 3: Linking It All Together
Lesson 3: Linking It All Together
 
Web 101 intro to html
Web 101  intro to htmlWeb 101  intro to html
Web 101 intro to html
 
TOSSUG HTML5 讀書會 新標籤與表單
TOSSUG HTML5 讀書會 新標籤與表單TOSSUG HTML5 讀書會 新標籤與表單
TOSSUG HTML5 讀書會 新標籤與表單
 
46h interaction 1.lesson Hello world
46h interaction 1.lesson Hello world46h interaction 1.lesson Hello world
46h interaction 1.lesson Hello world
 
Creating HTML Pages
Creating HTML PagesCreating HTML Pages
Creating HTML Pages
 
Enough with the javas cript already! de Nicholas Zakas
Enough with the javas cript already! de Nicholas ZakasEnough with the javas cript already! de Nicholas Zakas
Enough with the javas cript already! de Nicholas Zakas
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Introduction to blogging with Jekyll
Introduction to blogging with JekyllIntroduction to blogging with Jekyll
Introduction to blogging with Jekyll
 
Enough with the JavaScript already!
Enough with the JavaScript already!Enough with the JavaScript already!
Enough with the JavaScript already!
 
LIS3353 SP12 Week 4
LIS3353 SP12 Week 4LIS3353 SP12 Week 4
LIS3353 SP12 Week 4
 
HTML 5 Fundamental
HTML 5 FundamentalHTML 5 Fundamental
HTML 5 Fundamental
 
Html5 semantics
Html5 semanticsHtml5 semantics
Html5 semantics
 
LINKING IN HTML
LINKING IN HTMLLINKING IN HTML
LINKING IN HTML
 
Html hyperlinks
Html hyperlinksHtml hyperlinks
Html hyperlinks
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

Backbone JS - Journey to the Front End [Dev Nexus Conference]

  • 1. BACKBONE JS { Journey to the Front End } Brian Mann @backbonerails BackboneRails.com
  • 2. MY EXPERIENCE WITH BACKBONE
  • 3. A Little Perspective • Web Application Developer ‣ Backbone / Ruby on Rails • Scaling Our Project ‣ Totals about 600 JS files ‣ Close to 80 different JS modules ‣ 120+ server models ‣ Entirely Single Page • Published Screencasts ‣ Chronicles development patterns Backbone JS: Journey to the Front End BACKBONERAILS.com
  • 4. BACKBONE IN A NUTSHELL
  • 5. Key Points • Introduces the building blocks of MVC frameworks • Manages the complexity of front end logic • Provides the structural components for organizing ‣ Presentation ‣ Behavior ‣ Implementation • Keeps view changes in sync • Eliminates unmanageable spaghetti code Backbone JS: Journey to the Front End BACKBONERAILS.com
  • 6. Tenets of Backbone • Powered by RESTful JSON API • Low Profile ‣ Unopinionated ‣ Leaves implementation up to the developer • Small Set of Documentation • Huge Success Record ‣ Major players using it in production • Awesome Community Support Backbone JS: Journey to the Front End BACKBONERAILS.com
  • 8.
  • 9. Pandora Google Analytics WuFoo Rdio
  • 10. Google Analytics 1. Loading feedback while fetching data from server
  • 11. Google Analytics 1. Loading feedback while fetching data from server
  • 12. Google Analytics 2. Dialog Selection Events
  • 13. Google Analytics 2. Dialog Selection Events
  • 14. WuFoo 1. Picked up and dragged “Single Line Text”
  • 15. WuFoo 1. Picked up and dragged “Single Line Text”
  • 16. WuFoo 2. Passively saved to server, displayed single line text
  • 17. WuFoo 2. Passively saved to server, displayed single line text
  • 18. WuFoo 3. Two Way Data Binding
  • 19. WuFoo 3. Two Way Data Binding
  • 22. Rdio 1. Changing sort order - hovered over “Song” drop down
  • 23. Rdio 1. Changing sort order - hovered over “Song” drop down
  • 24. Rdio 2. Clicking “Artist” to sort songs by Artist
  • 25. Rdio 2. Clicking “Artist” to sort songs by Artist
  • 26. Rdio 3. Shows loading spinner while fetching new data
  • 27. Rdio 3. Shows loading spinner while fetching new data
  • 28. Rdio 4. New collection is shown, URL is updated
  • 29. Rdio 4. New collection is shown, URL is updated
  • 31. http://www.serversrule.com/ before 2005 Stateless Servers
  • 32. http://www.serversrule.com/ <html> <head> <title>Best Page in the Universe</title> </head> <body> <div id="header"> <ul> <li> <a href="link1">Link 1</a> </li> <li> <a href="link2">Link 2</a> </li> <li> <a href="link3">Link 3</a> </li> </ul> before 2005 </div> <div id="main">Home Page Content</div> </body> </html> Stateless Servers
  • 33. http://www.serversrule.com/ My Awesome Site Link 1 | Link 2 | Link 3 Home Page before 2005 Stateless Servers
  • 34. http://www.serversrule.com/ My Awesome Site Link 1 | Link 2 | Link 3 Home Page before 2005 Stateless Servers
  • 35. http://www.serversrule.com/link1 My Awesome Site Link 1 | Link 2 | Link 3 Home Page before 2005 Stateless Servers
  • 36. http://www.serversrule.com/link1 before 2005 Stateless Servers
  • 37. http://www.serversrule.com/link1 <html> <head> <title>Best Page in the Universe</title> </head> <body> <div id="header"> <ul> <li class="active"> <a href="link1">Link 1</a> </li> <li> <a href="link2">Link 2</a> </li> <li> <a href="link3">Link 3</a> </li> </ul> before 2005 </div> <div id="main">Link 1 - Content</div> </body> </html> Stateless Servers
  • 38. http://www.serversrule.com/link1 <html> <head> <title>Best Page in the Universe</title> </head> <body> <div id="header"> <ul> <li class="active"> <a href="link1">Link 1</a> </li> <li> <a href="link2">Link 2</a> </li> <li> <a href="link3">Link 3</a> </li> </ul> before 2005 </div> <div id="main">Link 1 - Content</div> </body> </html> Stateless Servers
  • 39. http://www.serversrule.com/link1 My Awesome Site Link 1 | Link 2 | Link 3 Link 1 - Content before 2005 Stateless Servers
  • 40. http://www.serversrule.com/link1 My Awesome Site Link 1 | Link 2 | Link 3 Link 1 - Content before 2005 Stateless Servers
  • 41. http://www.serversrule.com/link1 My Awesome Site Link 1 | Link 2 | Link 3 Link 1 - Content before 2005 2006 - 2009 Stateless Servers Heavy AJAX Use
  • 42. http://www.serversrule.com/link1 My Awesome Site Link 1 | Link 2 | Link 3 Link 1 - Content before 2005 2006 - 2009 Stateless Servers Heavy AJAX Use
  • 43. http://www.serversrule.com/link1 <html> My Awesome Site <head> Link 1 | Link 2 | Link 3 <title>Best Page in the Universe</title> </head> <body> <div id="header"> <ul> <li class="active"> Link 1 - Content </li> <a href="link1">Link 1</a> <li> <a href="link2">Link 2</a> </li> <li> <a href="link3">Link 3</a> </li> </ul> before 2005 </div> 2006 - 2009 <div id="main">Link 1 - Content</div> </body> </html> Stateless Servers Heavy AJAX Use
  • 44. http://www.serversrule.com/link1 <html> My Awesome Site <head> Link 1 | Link 2 | Link 3 <title>Best Page in the Universe</title> </head> <body> <div id="header"> <ul> <li class="active"> Link 1 - Content </li> <a href="link1">Link 1</a> <li> <a href="link2">Link 2</a> </li> <li> <a href="link3">Link 3</a> </li> </ul> before 2005 </div> 2006 - 2009 <div id="main">Link 1 - Content</div> </body> </html> Stateless Servers Heavy AJAX Use
  • 45. http://www.serversrule.com/link1 <html> My Awesome Site <head> Link 1 | Link 2 | Link 3 <title>Best Page in the Universe</title> </head> <body> <div id="header"> <ul> <li class="active"> Link 1 - Content </li> <a href="link1">Link 1</a> <li> <a href="link2">Link 2</a> </li> <li> <a href="link3">Link 3</a> </li> </ul> before 2005 </div> 2006 - 2009 <div id="main"> </div> </body> </html> Stateless Servers Heavy AJAX Use
  • 46. http://www.serversrule.com/link1 <html> My Awesome Site <head> Link 1 | Link 2 | Link 3 <title>Best Page in the Universe</title> </head> <body> <div id="header"> <ul> <li class="active"> Link 1 - Content </li> <a href="link1">Link 1</a> <li> <a href="link2">Link 2</a> </li> <li> <a href="link3">Link 3</a> </li> </ul> before 2005 </div> 2006 - 2009 <div id="main">Link 2 - Content</div> </body> </html> Stateless Servers Heavy AJAX Use
  • 47. http://www.serversrule.com/link1 <html> My Awesome Site <head> Link 1 | Link 2 | Link 3 <title>Best Page in the Universe</title> </head> <body> <div id="header"> <ul> <li class="active"> Link 1 - Content </li> <a href="link1">Link 1</a> <li> <a href="link2">Link 2</a> </li> <li> <a href="link3">Link 3</a> </li> </ul> before 2005 </div> 2006 - 2009 <div id="main">Link 2 - Content</div> </body> </html> Stateless Servers Heavy AJAX Use
  • 48. http://www.serversrule.com/link1 <html> My Awesome Site <head> Link 1 | Link 2 | Link 3 <title>Best Page in the Universe</title> </head> <body> <div id="header"> <ul> Link <a - Content 1</a> 1 href="link1">Link </li> <li> <a href="link2">Link 2</a> </li> <li> <a href="link3">Link 3</a> </li> </ul> before 2005 </div> 2006 - 2009 <div id="main">Link 2 - Content</div> </body> </html> Stateless Servers Heavy AJAX Use
  • 49. http://www.serversrule.com/link1 <html> My Awesome Site <head> Link 1 | Link 2 | Link 3 <title>Best Page in the Universe</title> </head> <body> <div id="header"> <ul> <li> Link 1 - Content </li> <a href="link1">Link 1</a> <li> <a href="link2">Link 2</a> </li> <li> <a href="link3">Link 3</a> </li> </ul> before 2005 </div> 2006 - 2009 <div id="main">Link 2 - Content</div> </body> </html> Stateless Servers Heavy AJAX Use
  • 50. http://www.serversrule.com/link1 <html> My Awesome Site <head> Link 1 | Link 2 | Link 3 <title>Best Page in the Universe</title> </head> <body> <div id="header"> <ul> <li> Link 1 - Content </li> <a href="link1">Link 1</a> <li> <a href="link2">Link 2</a> </li> <li> <a href="link3">Link 3</a> </li> </ul> before 2005 </div> 2006 - 2009 <div id="main">Link 2 - Content</div> </body> </html> Stateless Servers Heavy AJAX Use
  • 51. http://www.serversrule.com/link1 <html> My Awesome Site <head> Link 1 | Link 2 | Link 3 <title>Best Page in the Universe</title> </head> <body> <div id="header"> <ul> <li> Link 1 - Content <a href="link1">Link 1</a> </li> <a href="link2">Link 2</a> </li> <li> <a href="link3">Link 3</a> </li> </ul> before 2005 </div> 2006 - 2009 <div id="main">Link 2 - Content</div> </body> </html> Stateless Servers Heavy AJAX Use
  • 52. http://www.serversrule.com/link1 <html> My Awesome Site <head> Link 1 | Link 2 | Link 3 <title>Best Page in the Universe</title> </head> <body> <div id="header"> <ul> <li> Link 1 - Content </li> <a href="link1">Link 1</a> <li class="active"> <a href="link2">Link 2</a> </li> <li> <a href="link3">Link 3</a> </li> </ul> before 2005 </div> 2006 - 2009 <div id="main">Link 2 - Content</div> </body> </html> Stateless Servers Heavy AJAX Use
  • 53. http://www.serversrule.com/link1 My Awesome Site Link 1 | Link 2 | Link 3 Link 1 - Content before 2005 2006 - 2009 Stateless Servers Heavy AJAX Use
  • 54. http://www.serversrule.com/link1 My Awesome Site Link 1 | Link 2 | Link 3 Link 2 - Content before 2005 2006 - 2009 Stateless Servers Heavy AJAX Use
  • 55. http://www.serversrule.com/link1 My Awesome Site Link 1 | Link 2 | Link 3 Link 2 - Content before 2005 2006 - 2009 Stateless Servers Heavy AJAX Use
  • 56. http://www.serversrule.com/link1 My Awesome Site Link 1 | Link 2 | Link 3 Link 2 - Content before 2005 2006 - 2009 2010 - now Stateless Servers Heavy AJAX Use Modern MVC
  • 57. http://www.serversrule.com/link1 My Awesome Site Link 1 | Link 2 | Link 3 <Links Collection> Models: [ {name: “Link1”, active: false}, {name: “Link2”, active: true}, ] Link 2 - Content {name: “Link3”, active: false} before 2005 2006 - 2009 2010 - now Stateless Servers Heavy AJAX Use Modern MVC
  • 58. http://www.serversrule.com/link1 My Awesome Site Link 1 | Link 2 | Link 3 <Links Collection> Models: [ {name: “Link1”, active: false}, {name: “Link2”, active: true}, Object { ... type=”click” .. } ] Link 2 - Content {name: “Link3”, active: false} before 2005 2006 - 2009 2010 - now Stateless Servers Heavy AJAX Use Modern MVC
  • 59. http://www.serversrule.com/link1 My Awesome Site Link 1 | Link 2 | Link 3 <Links Collection> Models: 1. Capture event, prevent default action [ {name: “Link1”, 2. Call method on model to set {active: true} active: false}, {name: “Link2”, active: true}, Object { ... type=”click” .. } {name: “Link3”, 3. Fires event which causes previously ] Link 2 - Content active: false} selected <li> to deselect itself - and current <li> to select itself <li class=”active”>...</li> 4. Let our managing controller know this click event has occurred before 2005 2006 - 2009 2010 - now 5. Controller decides what the next action should be Stateless Servers Heavy AJAX Use Modern MVC
  • 60. Backbone Components • Entities ‣ Models ‣ Collections Backbone JS: Journey to the Front End BACKBONERAILS.com
  • 61. Backbone Components • Entities Model ‣ Models ‣ Collections User firstName: Brian lastName: Mann fullName() save() Backbone JS: Journey to the Front End BACKBONERAILS.com
  • 62. Backbone Components • Entities Model ‣ Models ‣ Collections User firstName: Brian lastName: Mann fullName() save() Backbone JS: Journey to the Front End BACKBONERAILS.com
  • 63. Backbone Components • Entities Model ‣ Models ‣ Collections User firstName: Brian lastName: Mann fullName() save() Backbone JS: Journey to the Front End BACKBONERAILS.com
  • 64. Backbone Components • Entities Events Model ‣ Models Name When This Event Triggers ‣ Collections User change when any model attributes have changed firstName: Brian change:[attribute] when a specific attribute has changed lastName: Mann destroy when a model is destroyed fullName() sync when a model has successfully synced with save() the server error when a model’s save call fails on the server when a models validations fails on the invalid client Backbone JS: Journey to the Front End BACKBONERAILS.com
  • 65. Backbone Components • Entities Collection ‣ Models ‣ Collections User User User User User User Backbone JS: Journey to the Front End BACKBONERAILS.com
  • 66. Backbone Components • Entities Collection ‣ Models Events ‣ Collections Name When This Event Triggers User User User add when a model is added to the collection remove when a model is removed from a collection when the collection’s entire contents have reset been replaced User User sort User when the collection has been re-sorted when a collection has started to request to request the server when a collection has been successfully sync synced with the server Backbone JS: Journey to the Front End BACKBONERAILS.com
  • 67. Backbone Components • Entities ‣ Models ‣ Collections • Views ‣ usually paired with a model or collection ‣ given a template (a chunk of HTML) ‣ responsible for rendering + responding to model/collection events Backbone JS: Journey to the Front End BACKBONERAILS.com
  • 68. Backbone Components • Entities ‣ Models ‣ Collections • Views ‣ usually paired with a model or collection ‣ given a template (a chunk of HTML) ‣ responsible for rendering + responding to model/collection events • Routers ‣ listen for and react to client side URLs Backbone JS: Journey to the Front End BACKBONERAILS.com
  • 69. Backbone Components • Entities http://www.app.com/#users ‣ Models ‣ Collections • Views ‣ usually paired with a model or collection Z ‣ given a template (a chunk of HTML) ‣ responsible for rendering + responding to model/collection events • Routers ‣ listen for and react to client side URLs Backbone JS: Journey to the Front End BACKBONERAILS.com
  • 70. Backbone Components • Entities ‣ Models ‣ Collections • Views ‣ usually paired with a model or collection ‣ given a template (a chunk of HTML) ‣ responsible for rendering + responding to model/collection events • Routers ‣ listen for and react to client side URLs • Events Backbone JS: Journey to the Front End BACKBONERAILS.com
  • 71. RELATIONSHIP BETWEEN VIEWS AND MODELS
  • 72. http://www.app.com/#users/1/edit Hi, Stanley Kubrick Edit Profile Name Stanley Kubrick Age 70 Gender male female Email stanley.kubrick@mgm.com Friends 1. Malcolm McDowell x 2. Arthur C. Clarke x 3. Peter Sellers x add new friend... + cancel Save
  • 73. http://www.app.com/#users/1/edit Hi, Stanley Kubrick Edit Profile Name Stanley Kubrick Age 70 View Gender male female Email stanley.kubrick@mgm.com Friends 1. Malcolm McDowell x 2. Arthur C. Clarke x 3. Peter Sellers x add new friend... + cancel Save
  • 74. http://www.app.com/#users/1/edit Hi, Stanley Kubrick Edit Profile Name Stanley Kubrick Age 70 View Gender male female Email stanley.kubrick@mgm.com Friends 1. Malcolm McDowell x 2. Arthur C. Clarke x 3. Peter Sellers x Model add new friend... Template + cancel Save
  • 75. { "id": 1, "picture": "images/user_1.png", "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "stanley.kubrick@mgm.com", "address": "Hertfordshire England", "friends": [ { "id": 1, "name": "Malcolm McDowell" }, { "id": 2, "name": "Arthur C. Clarke" }, { "id": 3, "name": "Peter Sellers" } ] }
  • 76. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Stanley Kubrick</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "stanley.kubrick@mgm.com", "address": "Hertfordshire England", "friends": [ { "id": 1, "name": "Malcolm McDowell" }, { "id": 2, "name": "Arthur C. Clarke" }, { "id": 3, "name": "Peter Sellers" } ] }
  • 77. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Stanley Kubrick</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "stanley.kubrick@mgm.com", <a href=”mailto:stanley.kubrick@mgm.com”> "address": "Hertfordshire England", Email Stanley "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, { "id": 2, "name": "Arthur C. Clarke" }, { "id": 3, "name": "Peter Sellers" } ] }
  • 78. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Stanley Kubrick</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "stanley.kubrick@mgm.com", <a href=”mailto:stanley.kubrick@mgm.com”> "address": "Hertfordshire England", Email Stanley "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] }
  • 79. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Stanley Kubrick</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "stanley.kubrick@mgm.com", <a href=”mailto:stanley.kubrick@mgm.com”> "address": "Hertfordshire England", Email Stanley "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] }
  • 80. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Stanley Kubrick</div> "age": 70, "name": "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "stanley.kubrick@mgm.com", <a href=”mailto:stanley.kubrick@mgm.com”> "address": "Hertfordshire England", Email Stanley "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] }
  • 81. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Stanley Kubrick</div> "age": 70, "name": "Paul Thomas Anderson", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "stanley.kubrick@mgm.com", <a href=”mailto:stanley.kubrick@mgm.com”> "address": "Hertfordshire England", Email Stanley "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] }
  • 82. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Stanley Kubrick</div> "age": 70, "name": "Paul Thomas Anderson", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "stanley.kubrick@mgm.com", <a href=”mailto:stanley.kubrick@mgm.com”> "address": "Hertfordshire England", Email Stanley "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] }
  • 83. { "id": 1, "picture": "images/user_1.png", "age": 70, "name": "Paul Thomas Anderson", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "stanley.kubrick@mgm.com", <a href=”mailto:stanley.kubrick@mgm.com”> "address": "Hertfordshire England", Email Stanley "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] }
  • 84. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Paul Thomas Anderson", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "stanley.kubrick@mgm.com", <a href=”mailto:stanley.kubrick@mgm.com”> "address": "Hertfordshire England", Email Stanley "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] }
  • 85. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "stanley.kubrick@mgm.com", <a href=”mailto:stanley.kubrick@mgm.com”> "address": "Hertfordshire England", Email Stanley "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] }
  • 86. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "stanley.kubrick@mgm.com", <a href=”mailto:stanley.kubrick@mgm.com”> "address": "Hertfordshire England", Email Stanley "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] }
  • 87. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": <a href=”mailto:stanley.kubrick@mgm.com”> "address": "Hertfordshire England", Email Stanley "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] }
  • 88. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "pta@ptanderson.com", <a href=”mailto:stanley.kubrick@mgm.com”> "address": "Hertfordshire England", Email Stanley "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] }
  • 89. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "pta@ptanderson.com", <a href=”mailto:stanley.kubrick@mgm.com”> "address": "Hertfordshire England", Email Stanley "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] }
  • 90. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "pta@ptanderson.com", "address": "Hertfordshire England", "friends": [ { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] }
  • 91. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", "email": "pta@ptanderson.com", <a href=”mailto:pta@ptanderson.com”> "address": "Hertfordshire England", Email Paul "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] }
  • 92. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", <a href=”mailto:pta@ptanderson.com”> "email": "stanley.kubrick@mgm.com", Email Paul "address": "Hertfordshire England", "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] ] } }
  • 93. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", <a href=”mailto:pta@ptanderson.com”> "email": "stanley.kubrick@mgm.com", Email Paul "address": "Hertfordshire England", "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" }, <div id=”friends”> { <span id=”count”>You have 3 friends:</span> "id": 2, <ul> "name": "Arthur C. Clarke" <li>Malcolm McDowell</li> }, <li>Arthur C. Clarke</li> { <li>Peter Sellers</li> "id": 3, </ul> "name": "Peter Sellers" </div> } ] ] } }
  • 94. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", <a href=”mailto:pta@ptanderson.com”> "email": "stanley.kubrick@mgm.com", Email Paul "address": "Hertfordshire England", "friends": [ </a> { "id": 1, "name": "Malcolm McDowell" } <div id=”friends”> <span id=”count”>You have 3 friends:</span> <ul> <li>Malcolm McDowell</li> <li>Arthur C. Clarke</li> <li>Peter Sellers</li> </ul> </div> ] ] } }
  • 95. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", <a href=”mailto:pta@ptanderson.com”> "email": "stanley.kubrick@mgm.com", Email Paul "address": "Hertfordshire England", "friends": [ </a> { "id": , "name": } <div id=”friends”> <span id=”count”>You have 3 friends:</span> ] <ul> } <li>Malcolm McDowell</li> <li>Arthur C. Clarke</li> <li>Peter Sellers</li> </ul> </div> ] }
  • 96. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", <a href=”mailto:pta@ptanderson.com”> "email": "stanley.kubrick@mgm.com", Email Paul "address": "Hertfordshire England", "friends": [ </a> { "id": 4 , "name": "Daniel Day Lewis" } <div id=”friends”> <span id=”count”>You have 3 friends:</span> ] <ul> } <li>Malcolm McDowell</li> <li>Arthur C. Clarke</li> <li>Peter Sellers</li> </ul> </div> ] }
  • 97. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", <a href=”mailto:pta@ptanderson.com”> "email": "stanley.kubrick@mgm.com", Email Paul "address": "Hertfordshire England", "friends": [ </a> { "id": 4 , "name": "Daniel Day Lewis" } <div id=”friends”> <span id=”count”>You have 3 friends:</span> ] <ul> } <li>Malcolm McDowell</li> <li>Arthur C. Clarke</li> <li>Peter Sellers</li> </ul> </div> ] }
  • 98. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", <a href=”mailto:pta@ptanderson.com”> "email": "stanley.kubrick@mgm.com", Email Paul "address": "Hertfordshire England", "friends": [ </a> { "id": 4 , "name": "Daniel Day Lewis" } ] } ] }
  • 99. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", <a href=”mailto:pta@ptanderson.com”> "email": "stanley.kubrick@mgm.com", Email Paul "address": "Hertfordshire England", "friends": [ </a> { "id": 4 , "name": "Daniel Day Lewis" } <div id=”friends”> <span id=”count”>You have 1 friend:</span> ] <ul> } <li>Daniel Day Lewis</li> </ul> </div> ] }
  • 100. { "id": 1, "picture": "images/user_1.png", <div id=”user”>Hi, Paul Thomas Anderson</div> "age": 70, "name": "Stanley Kubrick", "gender": "male", "company": "MGM", "phone": "832-547-3983", <a href=”mailto:pta@ptanderson.com”> "email": "stanley.kubrick@mgm.com", Email Paul "address": "Hertfordshire England", "friends": [ </a> { "id": 4 , "name": "Daniel Day Lewis" } <div id=”friends”> <span id=”count”>You have 1 friend:</span> ] <ul> } <li>Daniel Day Lewis</li> </ul> </div> ] }
  • 103. Title View View Layout Container
  • 104. Title View View Layout Container Day Views
  • 105. Title View Time Control View View Layout Container Day Views
  • 106. Title View Time Control View Chosen Time View View Layout Container Day Views
  • 107. Event
  • 108.  Calendar Month
  • 109.  
  • 110.  |
  • 111.  
  • 112.  Week
  • 113.  
  • 114.  |
  • 115.  
  • 116.  Day
  • 118.   M T W TH F S SU 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
  • 119. [{ id: 1, name: Doctors Appt, Event
  • 120.  Calendar Month
  • 121.  
  • 122.  |
  • 123.  
  • 124.  Week
  • 125.  
  • 126.  |
  • 127.  
  • 128.  Day where: Dentist, date: 02-02-2013,
  • 130.   time_start: 2:00pm, time_end: 3:00pm M T W TH F S SU },{ id: 2, name: Ruby Meetup, 1 2 3 4 5 6 7 where: Centergy Bld, date: 02-13-2013, time_start: 7:00pm, },{ time_end: 9:00pm 8 9 10 11 12 13 14 id: 3, name: Buy Flowers!, where: null, date: 02-14-2013, time_start: null, 15 16 17 18 19 20 21 time_end: null },{ id: 4, name: Visit Vet, where: Avian Center, date: 02-24-2013, 22 23 24 25 26 27 28 time_start: 10:00am, time_end: 11:00am }]
  • 131. [{ id: 1, name: Doctors Appt, Event
  • 132.  Calendar Month
  • 133.  
  • 134.  |
  • 135.  
  • 136.  Week
  • 137.  
  • 138.  |
  • 139.  
  • 140.  Day where: Dentist, date: 02-02-2013,
  • 142.   time_start: 2:00pm, time_end: 3:00pm M T W TH F S SU },{ id: 2, name: Ruby Meetup, 1 2 3 4 5 6 7 where: Centergy Bld, Doctors
  • 143.   date: 02-13-2013, Appt time_start: 7:00pm, },{ time_end: 9:00pm 8 9 10 11 12 13 14 id: 3, name: Buy Flowers!, Ruby
  • 144.   Buy
  • 145.   where: null, Meetup Flowers! date: 02-14-2013, time_start: null, 15 16 17 18 19 20 21 time_end: null },{ id: 4, name: Visit Vet, where: Avian Center, date: 02-24-2013, 22 23 24 25 26 27 28 time_start: 10:00am, time_end: 11:00am Visit
  • 146.   }] Vet
  • 147. [{ id: 1, name: Doctors Appt, Event
  • 148.  Calendar Month
  • 149.  
  • 150.  |
  • 151.  
  • 152.  Week
  • 153.  
  • 154.  |
  • 155.  
  • 156.  Day where: Dentist, date: 02-02-2013,
  • 158.   time_start: 2:00pm, time_end: 3:00pm M T W TH F S SU },{ id: 2, name: Ruby Meetup, 1 2 3 4 5 6 7 where: Centergy Bld, Doctors
  • 159.   date: 02-13-2013, Appt time_start: 7:00pm, },{ time_end: 9:00pm 8 9 10 11 12 13 14 id: 3, name: Buy Flowers!, Ruby
  • 160.   Buy
  • 161.   where: null, Meetup Flowers! date: 02-14-2013, time_start: null, 15 16 17 18 19 20 21 time_end: null },{ id: 4, name: Visit Vet, where: Avian Center, date: 02-24-2013, 22 23 24 25 26 27 28 time_start: 10:00am, time_end: 11:00am Visit
  • 162.   }] Vet
  • 163. [{ id: 1, name: Doctors Appt, Event
  • 164.  Calendar Month
  • 165.  
  • 166.  |
  • 167.  
  • 168.  Week
  • 169.  
  • 170.  |
  • 171.  
  • 172.  Day where: Dentist, date: 02-02-2013,
  • 174.   time_start: 2:00pm, time_end: 3:00pm M T W TH F S SU },{ id: 2, name: Ruby Meetup, 1 2 3 4 5 6 7 where: Centergy Bld, Doctors
  • 175.   date: 02-13-2013, Appt time_start: 7:00pm, },{ time_end: 9:00pm 8 9 10 11 12 13 14 id: 3, name: Buy Flowers!, Ruby
  • 176.   Buy