loading

Logout succeed

Logout succeed. See you again!

ebook img

Backbone.js Cookbook PDF

pages282 Pages
release year2013
file size2.77 MB
languageEnglish

Preview Backbone.js Cookbook

Backbone.js Cookbook Over 80 recipes for creating outstanding web applications with Backbone.js, leveraging MVC, and REST architecture principles Vadim Mirgorod BIRMINGHAM - MUMBAI Backbone.js Cookbook Copyright © 2013 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: August 2013 Production Reference: 1200813 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78216-272-8 www.packtpub.com Cover Image by J.Blaminsky ([email protected]) Credits Author Copy Editors Vadim Mirgorod Mradula Hegde Insiya Morbiwala Reviewers Alfida Paiva Ivano Malavolta Adithi Shetty Jan Carlo Viray Stephen Sawchuk Proofreader Clyde Jenkins Acquisition Editor Mary Nadar Indexer Hemangini Bari Lead Technical Editor Dayan Hyames Graphics Abhinash Sahu Technical Editors Aparna Chand Production Coordinator Dylan Fernandes Manu Joseph Kapil Hemnani Cover Work Virgin Juanita Manu Joseph Project Coordinator Kranti Berde About the Author Vadim Mirgorod is a professional web developer and an open source expert, who is passionate about technologies and innovations. He provides the code for the content management system Drupal and maintains several Backbone.js plugins. He is an active community member, who organized IT events in his city and spoke at the international conferences in Chicago, Munich, and Portland. His recent session at DrupalCon Portland was about Backbone.js. The following are some of the highlights of his career: f Presently he is running a company known as CoderBlvd (http://www.coderblvd.com), which is based in Ukraine. CoderBlvd provides IT outsourcing services for international businesses. f (August 2010- August 2013)He worked in Trellon, LLC as a Lead Developer, creating CRM-based systems and web applications, using Drupal and PHP. f (July 2009- August 2010)He used to give web development classes, when he was working in Donetsk National Technical University. You can reach him through his website at http://www.vmirgorod.name or by connecting to his Twitter account @dealancer. Acknowledgement I would like to thank Mary Nadar, Anish Ramchandani, Kranti Berde, and Dayan Hyames at Packt Publishing for providing me an opportunity to write my first book and for their guidance, patience, and encouragement. Also, I appreciate an incredible help from the review team in the person of Jan Carlo Viray and Ivano Malavolta, who provided their expertise to make this book more valuable. Many thanks to all the people at the Backbone.js community, who provided me with immediate answers for all my questions. Also thanks to all the guys at mongolab.com for their service. A huge thanks to Michael Haggerty, CEO of Trellon, for allowing me to take long hours off to complete this book and also for taking a look at some of the chapters. And finally, I send all my love and thanks to my wife Julia and my son Artem for their immense support, patience, and faith in me. About the Reviewers Ivano Malavolta is a research fellow at the Information Engineering, Computer Science, and Mathematics department of the University of L'Aquila. He holds a Ph.D. degree and is currently doing research on mobile (web) apps development, software architecture, and model-driven engineering. He is also teaching these topics in dedicated courses at the University of L'Aquila, for both bachelor and master degrees. For what concerns his research activities, he is actively collaborating with the following institutions: f Computer Communications Department (Middlesex University, London, U.K.) f Software Engineering Group (VU University, Amsterdam, the Netherlands) f Software Engineering Research Group (Istituto di Scienza e Tecnologie dell'Informazione A. Faedo ISTI - CNR, Pisa, Italy) f School of Innovation, Design, and Engineering (Mälardalen University, Västerås, Sweden) His main professional activities are listed as follows: f (from December 2011) Freelance: Design and development of mobile and web applications. f (May–February 2010) Software Architect & Project Manager, Tribe ICT business sector: Geographic Information Systems. His main responsibilities were design, management, and technological support for the development of a distributed, extensible, and customizable GIS framework. The system is based on the uDig platform (http://www.udig.org) and exploits the following technologies: Java, Eclipse (RCP, EMF, JFace), JTS, Geoserver, and Geonetwork. f (October–February 2008) Developer, Medea ICT business sector: Information Technologies, document management systems. His main responsibilities were development of a document management system in accordance with Italian security laws for the Regione Abruzzo. The system has been implemented as a J2EE web application using the following technologies: Java, JSF, IBM DB2, Eclipse, Jboss, Hibernate, Acegi Security, and Ja-sig CAS single sign-on system. Jan Carlo Viray is an aspiring entrepreneur with a background in business and web development. He has experience in .NET, PHP, Node.js, and is specializing in frontend development. He has a strong passion for growth and to help others reach their potential. He attributes all his talents and successes to God as he lives his life to the fullest daily. Making Jesus Lord of his life, he strives daily to be a man of God. He is a graduate of Cal State Long Beach, earning a title of cum laude. Nothing is impossible for him, because God is always by his side. He currently lives with his wonderful and loving wife at Los Angeles, CA. You can reach him through his website at www.jancarloviray.com or by connecting to his Twitter account @jancarloviray. I would like to first and foremost thank God who has given me talents, opportunities, friendships, and blessings that has helped me throughout my life. I would also like to thank my parents, who have sacrificed so much to raise me and to help me have a great future. Lastly, I would like to thank my wife who has been very patient, respectful, loving, kind, and supportive in every way so that I can fulfill my dreams and live my life to the fullest. www.PacktPub.com Support files, eBooks, discount offers and more You might want to visit www.PacktPub.com for support files and downloads related to your book. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. Why Subscribe? f Fully searchable across every book published by Packt f Copy and paste, print and bookmark content f On demand and accessible via web browser Free Access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access. Table of Contents Preface 1 Chapter 1: Understanding Backbone 5 Introduction 5 Designing an application with the MVC pattern 7 Defining business logic with models and collections 11 Modeling an application's behavior with views and a router 14 Creating an application structure from scratch 18 Writing your first Backbone application 20 Implementing URL routing in your application 24 Extending an application with plugins 27 Contributing to the Backbone project 28 Chapter 2: Models 29 Introduction 29 Creating a model 30 Operating with model attributes 33 Operating with the model identifier 34 Validating model attributes 35 Overriding getters and setters 37 Creating undo points to store/restore a model's state 41 Implementing workflow for a model 45 Using advanced validation in a model 49 Validating an HTML form 54 Working with nested attributes in a model 57 Implementing a one-to-one relationship 60

See more

The list of books you might like