Module Flvorful::SuperInplaceControls::ControllerMethods
In: vendor/plugins/super_inplace_controls/lib/super_inplace_controls.rb

MAIN

These controls were designed to be used with habtm & hm associations. Just use the object and the foreign key as the attribute (see examples). You can specify a chain of methods to use for the final display text (so you dont see the foreign key id)

Controller methods. Call just like the prototype helper method in_place_edit_for

OPTIONS

final_text - this is an array of methods calls or a special symbol to be executed after the update<br> example:<br> in_place_edit_for( :prospect, "status_id", { :final_text => ["status", "title"] }) This will chain the methods together to display the final text for the update. The method call will look like: object.status.title

special symbols collection - Use this as your final text if you want to use a checkbox collection on a HABTM or HM association. This will call a method stack similar to: object.collections.map { |e| e.title || e.name }.join(", ")<br> example: in_place_edit_for :product, :category_ids, {:final_text => :collection }

highlight_endcolor - the end color for the "highlight" visual effect.<br> example: in_place_edit_for( :prospect, "status_id", { :final_text => ["status", "title"], highlight_endcolor => "’ffffff’" })

highlight_startcolor - the start color for the "highlight" visual effect.<br> example: in_place_edit_for( :prospect, "status_id", { :final_text => ["status", "title"], :highlight_startcolor => "’ffffff’" })

error_messages - the error messages div that errors will be put into. defaults to error_messages<br> example: in_place_edit_for( :prospect, "status_id", { :error_messages => "my_error_div", :highlight_startcolor => "’ffffff’" })

error_visual_effect - The visual effect to use for displaying your error_message div. Defaults to :slide_down. <br> example: in_place_edit_for( :prospect, "status_id", { :error_visual_effect => :appear })

TODO

final_text_operation - this is a helper method that you want to call once the final_text is generated<br> example: in_place_edit_for( :prospect, "status_id", { :final_text => ["status", "title"] }, { :final_text_operation => ["truncate", 30] }) This will call truncate on the final_text and pass in 30 as the argument. Everything after the first argument (the method to call) is sent as an argument to the method. The method call is similar to: truncate(, 30)

Methods

Public Instance methods

[Source]

    # File vendor/plugins/super_inplace_controls/lib/super_inplace_controls.rb, line 49
49:                         def in_place_edit_for(object, attribute, options = {}) 
50:                                 define_method("set_#{object}_#{attribute}") do
51:                                         setup_inplace_object(object, attribute, options)
52:                                         if @item.update_attributes(attribute => params[object][attribute])
53:                                                 set_final_text(object, attribute, options)
54:                                                 standard_inplace_render
55:                                         else
56:                                                 inplace_error_render
57:                                         end
58:                                 end
59:                         end

[Source]

    # File vendor/plugins/super_inplace_controls/lib/super_inplace_controls.rb, line 61
61:                         def jquery_enabled?
62:                                 ActionView::Helpers::PrototypeHelper.const_defined?("JQUERY_VAR")
63:                         end

[Validate]