The Rails View: Creating a Beautiful and Maintainable User Experience

Overview

Working in the View layer requires a breadth of knowledge and attention to detail unlike anywhere else in Rails. One wrong move can result in brittle, complex views that stop future development in its tracks. This book will help you break free from tangles of logic and markup in your views as you pick up the practical skills you need to implement your user interface cleanly and maintainably.

You'll discover how to build up solid, sustainable layouts and popular interface ...

See more details below
Paperback
$24.70
BN.com price
(Save 29%)$35.00 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (18) from $4.11   
  • New (11) from $19.43   
  • Used (7) from $4.11   
Sending request ...

Overview

Working in the View layer requires a breadth of knowledge and attention to detail unlike anywhere else in Rails. One wrong move can result in brittle, complex views that stop future development in its tracks. This book will help you break free from tangles of logic and markup in your views as you pick up the practical skills you need to implement your user interface cleanly and maintainably.

You'll discover how to build up solid, sustainable layouts and popular interface elements with semantic HTML5 and CSS3, and when you can responsibly generate markup and use advanced presenters... all without leaving the designers on your team out in the cold. Widen your appeal with responsive design, and discover how new progressive enhancement techniques can take you beyond the "weakest link" approach of the past. Master the asset pipeline introduced in Rails 3.1 and use Sass and Coffeescript to make your interface code shorter and more enjoyable.

You'll create elegant, well-structured views that are a joy to build on. You'll appreciate its comprehensive, objective guidance in a realm full of subjective opinions.

What You Need:

All examples in the book assume Rails 3.1 or later and Ruby 1.9.x are installed. Detailed information on how to install these for Windows, Mac OS X and Linux is included in the book.

Read More Show Less

Editorial Reviews

From the Publisher
"This book represents the wisdom gained from years’ worth of building maintainable interfaces by two of the best and brightest minds in our business. I have been writing Ruby code for over a decade and Rails code since its inception, and out of all the Ruby books I’ve read, I value this one the most."

—Rich Kilmer, Director, RubyCentral

"Finally! An authoritative and up-to-date guide to everything view-related in Rails 3. If you’re stabbing in the dark when putting together your Rails apps’ views, The Rails View provides a big confidence boost and shows how to get things done the right way."

—Peter Cooper, Editor, Ruby Inside and Ruby Weekly

"In the past several years, I’ve been privileged to work with some of the world’s leading Rails developers. If asked to name the best view-layer Rails developer I’ve met, I’d have a hard time picking between two names: Bruce Williams and John Athayde. This book is a rare opportunity to look into the minds of two of the leading experts on an area that receives far too little attention. Read, apply, and reread."

—Chad Fowler, VP Engineering, LivingSocial

Read More Show Less

Product Details

  • ISBN-13: 9781934356876
  • Publisher: Pragmatic Bookshelf
  • Publication date: 4/3/2012
  • Pages: 264
  • Sales rank: 1,375,476
  • Product dimensions: 7.58 (w) x 8.80 (h) x 0.82 (d)

Meet the Author

Bruce Williams is a longtime speaker, trainer, designer, and book contributor in the Ruby and Rails community and has experience in everything from low-level data processing backends to front-end user interaction. He is a Senior Developer in R&D at LivingSocial.

John Athayde is a UI/UX/Design type who comes from an architecture (of the building variety) background. He's been in the Rails community since 2006 and has broad experience in e-commerce and running creative teams. He is currently a Senior UI/UX Designer at LivingSocial.

Read More Show Less

Table of Contents

Acknowledgments ix

Preface xi

1 Creating an Application Layout 1

1.1 Creating a Basic Layout 2

1.2 Setting Up a Boilerplate 6

1.3 Building the Page Frame 14

1.4 Adding a Sidebar 23

1.5 Adding Navigation 28

1.6 Displaying Notifications 36

1.7 Validating Our Code 39

1.8 Testing Internet Explorer 41

1.9 Wrapping Up 47

2 Improving Readability 49

2.1 Choosing a Templating Language 49

2.2 Standardizing Coding Practices 51

2.3 Simplifying Complex Output 56

2.4 Working with Models 63

2.5 Displaying Conditional Content 65

2.6 Adding Model DOM IDs for JavaScript 69

2.7 Cleaning Up 71

2.8 Wrapping Up 72

3 Adding Cascading Style Sheets 73

3.1 Using the Asset Pipeline 73

3.2 Learning SCSS 76

3.3 Adding Sprites 88

3.4 Using Web Fonts 92

3.5 Wrapping Up 98

4 Adding JavaScript 101

4.1 Using JavaScript from Rails 101

4.2 Testing Ajax 110

4.3 Wrapping Up 117

5 Building Maintainable Forms 119

5.1 Using Semantic Form Tags 119

5.2 Building Custom Form Builders 132

5.3 Looking Toward the Future of HTML5 Form Elements 140

5.4 Wrapping Up 142

6 Using Presenters 143

6.1 Presenting a Record 144

6.2 Presenting Multiple Records 153

6.3 Using Presenters for Serialization 158

6.4 Wrapping Up 161

7 Handling Mobile Views 163

7.1 Building a Flexible Layout 164

7.2 The Next Level with Responsive Design (©media queries) 168

7.3 Using Mobile-Specific Templates 174

7.4 Using jQuery Mobile 179

7.5 Wrapping Up 188

8 Working with Email 189

8.1 Building a Mailer 189

8.2 Handling Email Templates 191

8.3 Testing Locally 195

8.4 Testing Across Clients 196

8.5 Wrapping Up 206

9 Optimizing Performance 207

9.1 A/B Testing with Vanity 207

9.2 Performance Testing and Maintenance 214

9.3 Wrapping Up 228

9.4 Where Do We Go from Here? 229

A1 The Rails View Rules 233

A2 Bibliography 235

Index 237

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)