BackboneJS与Rails

Earlier this summer I had the opportunity to speak at a fantastic regional conference,Magma Rails.

The location is not what you might expect, being an off-the-beaten-path part of Mexico. There are no crowds of American and European touristas — well none outside of the crowd of non-Mexican rubyists.

On the other hand, you are deep in Mexico, midway along the Pacific coast, with nice beaches and lovely mountains. The sponsors, Mexican rubyists, and people in general are genial and engaging, making us touristas feel right at home.

The original talk topic was going to be Cucumber, instead I opted1 for talk titled Getting started with Backbone and Rails, 25 things you need to know (ShowOff slides). The talk has a fair bit of code, drawn from a working example. The example app was going to be released after the conference…

…and, long story short, that never2 happened…

…until now!

[b]An example app[/b]

The app is incomplete, lacking tests, and written for clarity not conciseness. All of the JavaScript. code is written in CoffeeScript3. The Rails code is mostly scaffolding. You can find the source on github.

Over roughly 22 commits, the app is transformed into a one-page Backbone app that:

1. shows a list of movies
2. allows drilling into a specific movie
3. can add a new movie
4. can deleted an existing movie
5. sorts the list of movies
6. allows deep links directly to a specific movie

The app demonstrates how to structure a Backbone app for use with the asset pipeline, how to write views, handle forms, and interact with models, and how to fit Backbone in with Rails.


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/301743/viewspace-743726/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/301743/viewspace-743726/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值