Edit in place plugin for jRails.
JavaScript Ruby
Switch branches/tags
Nothing to show
Pull request Compare This branch is 24 commits ahead of rakuto:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
javascripts
lib
tasks
test
MIT-LICENSE
README
Rakefile
init.rb
install.rb
uninstall.rb

README

JrailsInPlaceEditing
====================

Edit in place for jRails.

Changelog for jquery.inplace.js
====================

Added datepicker options hash:

    datepicker_options

Instead of using bg_over/bg_out color, a CSS class inplace_hover is used

Now select_options accept jsoned array of arrays for options values

Changelog against fork master:
====================

Non AR ORMs adaptation, instead of direct AR dependency (MongoMapper f.e.)

Added datepicker support:

	you can give the in_place_editor_options hash an extra option :datepicker => 'datepicker'

Fixed the following lines of code in jrails_in_place_macros_helper:

    <code>
	js_options['select_options'] = "'" + (options[:select_options].is_a?(Array)?
      options[:select_options].join(',') : options[:select_options]) + "'" if js_options[:options].to_s == 'select'
    <code>
      
      to 
    
    <code>
	js_options['select_options'] = "'" + (options[:select_options].is_a?(Array)?
      options[:select_options].join(',') : options[:select_options]) + "'" if options[:field_type].to_s == 'select'
	<code>

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