支持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 = Post.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 # 视图 <%= in_place_editor_field :post, :title %> # 带参数的即时编辑 <%= in_place_editor_field :post, :title, {}, {:field_type => 'textarea', :textarea_cols => 25, :textarea_rows => 10}%> <%= in_place_editor_field :post, :title, {}, {:field_type => 'textarea', :textarea_rows => 10}%>
- 1
- 粉丝: 1
- 资源: 2
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助