Changeset 3032
- Timestamp:
- 11/14/05 20:46:32 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r3015 r3032 1 1 *SVN* 2 3 * Updated docs for in_place_editor, fixes a couple bugs and offers extended support for external controls [Justin Palmer] 2 4 3 5 * Update documentation for render :file. #2858 [Tom Werner] trunk/actionpack/lib/action_controller/macros/in_place_editing.rb
r2191 r3032 15 15 # 16 16 # # View 17 # <%= in_place_editor_field :post, title%>17 # <%= in_place_editor_field :post, 'title' %> 18 18 # 19 19 # For help on defining an in place editor in the browser, trunk/actionpack/lib/action_view/helpers/java_script_macros_helper.rb
r2537 r3032 29 29 # 30 30 # Addtional +options+ are: 31 # <tt>:rows</tt>:: Number of rows (more than 1 will use a TEXTAREA) 32 # <tt>:cancel_text</tt>:: The text on the cancel link. (default: "cancel") 33 # <tt>:ok_text</tt>:: The text on the save link. (default: "ok") 34 # <tt>:options</tt>:: Pass through options to the AJAX call (see prototype's Ajax.Updater) 35 # <tt>:with</tt>:: JavaScript snippet that should return what is to be sent 36 # in the AJAX call, +form+ is an implicit parameter 31 # <tt>:rows</tt>:: Number of rows (more than 1 will use a TEXTAREA) 32 # <tt>:cancel_text</tt>:: The text on the cancel link. (default: "cancel") 33 # <tt>:save_text</tt>:: The text on the save link. (default: "ok") 34 # <tt>:external_control</tt>:: The id of an external control used to enter edit mode. 35 # <tt>:options</tt>:: Pass through options to the AJAX call (see prototype's Ajax.Updater) 36 # <tt>:with</tt>:: JavaScript snippet that should return what is to be sent 37 # in the AJAX call, +form+ is an implicit parameter 37 38 def in_place_editor(field_id, options = {}) 38 39 function = "new Ajax.InPlaceEditor(" … … 41 42 42 43 js_options = {} 43 js_options['cancelText'] = options[:cancel_text]if options[:cancel_text]44 js_options['okText'] = options[:save_text]if options[:save_text]44 js_options['cancelText'] = %('#{options[:cancel_text]}') if options[:cancel_text] 45 js_options['okText'] = %('#{options[:save_text]}') if options[:save_text] 45 46 js_options['rows'] = options[:rows] if options[:rows] 47 js_options['externalControl'] = options[:external_control] if options[:external_control] 46 48 js_options['ajaxOptions'] = options[:options] if options[:options] 47 49 js_options['callback'] = "function(form) { return #{options[:with]} }" if options[:with] … … 60 62 tag_options = {:tag => "span", :id => "#{object}_#{method}_#{tag.object.id}_in_place_editor", :class => "in_place_editor_field"}.merge!(tag_options) 61 63 in_place_editor_options[:url] = in_place_editor_options[:url] || url_for({ :action => "set_#{object}_#{method}", :id => tag.object.id }) 62 tag.to_content_tag(tag_options [:tag], tag_options) +64 tag.to_content_tag(tag_options.delete(:tag), tag_options) + 63 65 in_place_editor(tag_options[:id], in_place_editor_options) 64 66 end