Nexus Weblogging
ChinaonRails
You are here ChinaonRails > Ruby on Rails > > 关于UJS插件和其他

zhangzhai


0.998%

disconnected
登录后回复主题 | 跳到回复(2)

关于UJS插件和其他

... by zhangzhai ... 6 月 24 天前 ... 120 次点击

看到一个网站源代码里有个插件叫 Unobtrusive Javascript 就google了一下,发现这个网站

http://ujs4rails.com/

一句话介绍就是“Rails is a great framework, especially for writing AJAX applications, but the Javascript that the built-in Rails helpers output is a bone of contention for many. Unobtrusive Javascript for Rails aims to change that.”

基本方法就是在rhtml里写方法
<% apply_behaviour 'a.external:click', 'window.open(this.href, "ext"); return false;' %>

然后放到rails2.0测试了一下,出错,到google group一看,dan大牛已经不再维护了,跳到low pro去了

https://groups.google.com/group/ujs4rails/browse_thread/thread/bfb6895ca45faaea
http://www.danwebb.net/lowpro

lowpro是什么?就是UJS插件里的主要的js库,详细的可以看这两篇

http://jlaine.net/2007/8/3/from-rails-ajax-helpers-to-low-pro-part-i

http://jlaine.net/2007/8/6/from-rails-ajax-helpers-to-low-pro-part-2

完全的JS和html分离,更美观,更强壮(没有打开JS的也支持)

基本方法是建个js文件,写:

Event.addBehavior({
'#add_form' : function() {
this.hide();
}
});

应该是以后的趋势吧,以前也看到说要把rails ajax helper移出来,不知道什么时候官方收录,有兴趣的可以看看。有用过的说说心得吧。

1 - 5-1 21:09
zhangzhai 楼主 上海
搜了一下去年就有了,火星了
http://chinaonrails.com/topic/view/1046.html

http://lowpro.stikipad.com/home/
Low Pro is a set of extensions to the Prototype library that make it easier to implement unobtrusive DOM scripting.
Latest Release – 0.5 now compatible with Prototype 1.6
2 - 5-2 0:10
bd7lx 深圳
http://chinaonrails.com/topic/view/441.html

里面的电影很好看
看完之后有话想说?那就帮楼主加盖一层吧!

在回复之前你需要先进行登录
电子邮件或昵称
密码
© 2007 A Jesse Cai Production   -   About   -   京ICP备07020911号
a site powered by Project Babel