- 博客(16)
- 收藏
- 关注
原创 jQuery and JavaScript CSS !important
原文 http://hungred.com/how-to/jquery-javascript-css-important/关键点[code="java"]jQuery('#id').css('cssText', 'height: 200px !important');[/code]
2011-03-28 13:19:18
213
原创 使用rails虚拟属性配合前台js处理时间
Helper方法用于虚拟属性的时间转换。[code="ruby"]module Admin::TimeFormatsHelper # hh:mm:ss => seconds def forward_time_convert(time_virtual) time_collect = time_virtual.split(":") time_collect[...
2011-02-15 10:49:18
178
accepts_nested_attributes_for: 关联表字段错误信息本地化
[code="java"]class Order has_many :order_informations accepts_nested_attributes_for :order_informationsendclass OrderInformation belongs_to :order validates_presence_of :quantity...
2011-01-14 14:26:42
185
原创 Jstree 1.0rc api调用
[code="java"] $("#search").click(function () { $(".tree").jstree("search",$("#search_str").val()); });[/code]"search"就是api中提供的那些方法 这样调用[code="java"]/* METHOD TWO
2010-12-09 17:45:46
221
原创 Unobtrusive Javascript in rails 3
Rails3中Unobtrusive Javascript的核心是rails.js文件。当你新建一个RAILS的应用时 这个文件就和Rails2中prototype.js一样直接在public/javascript下创建了。默认的文件是prototype的实现,但也有官方的[url=http://github.com/rails/jquery-ujs]rails.js jQuery version...
2010-11-19 16:29:58
191
原创 Jstree 1.0.2rc Config
[code="javascript"]$(function () { $("#search").click(function () { $("#taxon_tree").jstree("search",$("#search_str").val()); }); $("#taxon_tree") .jstree({ "plugi
2010-11-16 11:19:33
180
原创 Rails3 no route match.
由于rails3不再死绑prototype 一些之前默认会加载好的东西就需要自己来了 多次碰到no routes match问题都是因为rails.js没有加载 ……今天加了一个新的js进来 顺便动了下js文件的顺序 就再次餐具了再加一个 [b]rails.js一定要在jquery后面加载……[/b][b]rails form_for 配置导致的no routes...
2010-11-11 17:23:04
195
原创 Rails3 tree 输出
相关工具用的是 jstree 和 ancestry 就是个helper 遍历tree输出的方法关键在于raw方法 rails3里content_tag貌似内置了自动转义 需要加上这个方法才可以正确输出html[code="ruby"] def tree_traversal(nodes, node_layer_array = []) return "" if nodes.bl...
2010-11-02 13:12:20
224
原创 Jquery 小技巧
[size=large][b]查找出对象为一段html时 查找this的子对象用children无效 要用find。[/b][/size][code="java"] $.each($("#sortable .template"),function(i,n){ alert($(this).find(".step_name").attr('name')); });[/code]...
2010-10-23 13:37:02
153
原创 使用Git 作为项目管理工具开发时的方式和注意事项
1.所有新项目都要先创建 .gitignore文件 用于控制垃圾文件的提交 在有新的插件加入生成文件时记得随时更新 下面是一份相对较全的gitignore文件[code="ruby"]# OS generated files #######################.DS_Store?ehthumbs.dbThumbs.db# Config files #...
2010-10-14 10:02:48
201
【翻译】171-Delayed job
[url=http://github.com/tobi/delayed_job/tree/master]Delayed_job plugin[/url]是一个健壮的稳定的用于在后台运行任务的解决方案。下面的例子中,使用一个邮件群发的程序来做演示。如下图,点击'deliver'后,将开始发送邮件.例子中每个请求大概需要10秒的时间来执行,对使用者来说,点一个链接要等待10多秒显然太久了....
2010-04-05 02:30:27
230
原创 Rails litte tip
[b]1.部署时遇到 HTTP 400 错误[/b] 找了半天才发现 是URL路径里用了下划线导致了这个问题。URL不能包含下划线…… 还真没注意这个东西。[b]2.过滤掉html标签[/b]RAILS提供了方法 strip_tags。 自己还写了半天正则。。 餐具[b]3.从formbuilder中直接获取对象[/b][code="ruby"]form_f...
2010-02-01 09:11:15
201
CSS小记
[size=large][b]1.Label与Textarea顶部对齐[/b][/size]label与textarea默认是底部对齐,如果textarea的行数(rows)很多就很不美观。在label中加入样式 vertical-align:top,就能使文字与textarea顶部对齐了。例如:[code="html"]评论内容: [/code][size=lar...
2009-12-25 15:30:32
195
原创 DIV遮罩效果
[code="javascript"]document.observe('dom:loaded', function(){ $('panel_edit').observe('click', function(event){ shadow_show(this.getAttribute('name')); }); $('exit').observe(...
2009-12-10 12:50:08
167
原创 Rspec基础
初次接触Rspec 发现网上基本资料少的可怜 找到点啥先记下备用~assert_template 测试是否装载了正确的viewassert_tag 'form',:attributes=>{:action=>'/admin/....'} 测试View中是否有这表单,form也可以是div,td,input等html元素。assert_response :redirect...
2009-11-17 15:34:53
248
WEB前台
[size=large][b]1.动态加载JS CSS文件[/b][/size][code="javascript"]document.getElementsByTagName("head")[0].appendChild(fileref)[/code][size=large][b]2.浏览器版本检测[/b][/size]这个估计不会太准确 传说可以伪装浏览器信息[co...
2009-11-11 09:40:37
171
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人