public
Fork of rakuto/jrails_in_place_editing
Description: Edit in place plugin for jRails.
Clone URL: git://github.com/bpokosh/jrails_in_place_editing.git
name age message
file MIT-LICENSE Fri Apr 25 22:18:09 -0700 2008 first commit [rakuto]
file README Fri May 02 22:15:05 -0700 2008 update [rakuto]
file Rakefile Fri Apr 25 22:18:09 -0700 2008 first commit [rakuto]
file init.rb Fri Apr 25 23:17:41 -0700 2008 update [rakuto]
file install.rb Fri Apr 25 22:18:09 -0700 2008 first commit [rakuto]
directory javascripts/ Fri Apr 25 22:18:09 -0700 2008 first commit [rakuto]
directory lib/ Mon Jul 21 12:36:18 -0700 2008 fixed select box [bpokosh]
directory tasks/ Fri Apr 25 22:18:09 -0700 2008 first commit [rakuto]
directory test/ Fri May 02 21:55:35 -0700 2008 Update README and create tests [rakuto]
file uninstall.rb Fri Apr 25 22:18:09 -0700 2008 first commit [rakuto]
README
JrailsInPlaceEditing
====================

Edit in place for jRails.

Example
=======
  # Controller
    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
  
  # View
  <%= in_place_editor_field :post, :title %>

  # Pass some options
  <%= 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}%>
 
For more details, see comments in jrails_in_place_macros.rb.

Dual Licenses
================
This plugin uses implementaion of in-place editor for jQuery, created by Rakuto Furutani
Implementation of in-place editor for jQuery that created by David Hauenstein is used.
Thank you.

Copyright (c) 2008 Rakuto Furutani, released under the MIT license