Edit in place for jRails.

上传:lovejlj 浏览: 34 推荐: 0 文件:rar 大小:12KB 上传时间:2019-04-02 01:13:48 版权申诉
支持JQuery的Edit In Place Rails插件(rakuto),使用简便轻巧,与大家共享。 例子 ======= # 控制器 class BlogController < ApplicationController in_place_edit_for :post, :title end # Customize the action that update the value class BlogController < ApplicationController # set_#{object}_#{title} def set_post_title post = P ost.find(params[:id]) post.title = params[:value] # Name of parameter is always 'value'. post.save # It should render a text render :text => post.title end end # 视图 # 带参数的即时编辑 'textarea', :textarea_cols => 25, :textarea_rows => 10}%> 'textarea', :textarea_rows => 10}%> ost.find(params[:id]) post.title = params[:value] # Name of parameter is always 'value'. post.save # It should render a text render :text => post.title end end # 视图 # 带参数的即时编辑 'textarea', :textarea_cols => 25, :textarea_rows => 10}%> 'textarea', :textarea_rows => 10}%>
上传资源
用户评论