Book Image

Backbone.js Blueprints

By : Andrew Burgess
Book Image

Backbone.js Blueprints

By: Andrew Burgess

Overview of this book

<p>Backbone.js is an open source, JavaScript library that helps you to build sophisticated and structured web apps. It's important to have well-organized frontend code for easy maintenance and extendability. With the Backbone framework, you'll be able to build applications that are a breeze to manage.<br /><br />In this book, you will discover how to build seven complete web applications from scratch. You'll learn how to use all the components of the Backbone framework individually, and how to use them together to create fully featured applications. In addition, you'll also learn how Backbone thinks so you can leverage it to write the most efficient frontend JavaScript code.<br /><br />Through this book, you will learn to write good server-side JavaScript to support your frontend applications. This easy-to-follow guide is packed with projects, code, and solid explanations that will give you the confidence to write your own web applications from scratch.</p>
Table of Contents (14 chapters)
Backbone.js Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 4. Building a Calendar

We're going to build a calendar in this chapter. You might think that's what we built in the last chapter, but this one is going to be different; it will be like a very boiled-down version of Google Calendar. We'll be able to view a month or a day at a time, and plan events that span a certain number of hours.

In this chapter, we will discuss the following ideas:

  • Better application component organization, with only one global variable for the whole application

  • Putting model functionality inside model methods

  • Using disposable models to encapsulate important information that we don't need to store on the server

  • Displaying a single model instance in multiple views

You can begin with the project template, as we have done before. However, we'll be using precompiled templates as we did in the previous chapter, and we'll also be separating our code into models.js, views.js, and router.js. You may choose to copy the previous project and clear out the custom code instead...