Module: ActionView::Helpers::JavaScriptMacrosHelper
- Defined in:
- lib/smklib/somekool_scaffold.rb
Instance Method Summary collapse
- #in_place_collection_dropdown(field_id, options = {}) ⇒ Object
- #in_place_editor_dropdown(object, method, tag_options = {}, in_place_editor_options = {}) ⇒ Object
Instance Method Details
#in_place_collection_dropdown(field_id, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/smklib/somekool_scaffold.rb', line 16 def in_place_collection_dropdown(field_id, = {}) function = "new Ajax.InPlaceCollectionEditor(" function << "'#{field_id}', " function << "'#{url_for([:url])}'" = {} ['cancelText'] = %('#{[:cancel_text]}') if [:cancel_text] ['okText'] = %('#{[:save_text]}') if [:save_text] ['loadingText'] = %('#{[:loading_text]}') if [:loading_text] #js_options['rows'] = options[:rows] if options[:rows] #js_options['cols'] = options[:cols] if options[:cols] #js_options['size'] = options[:size] if options[:size] ['collection'] = [:collection] if [:collection] ['value'] = [:value] if [:value] ['externalControl'] = "'#{[:external_control]}'" if [:external_control] ['loadTextURL'] = "'#{url_for([:load_text_url])}'" if [:load_text_url] ['ajaxOptions'] = [:options] if [:options] ['evalScripts'] = [:script] if [:script] ['callback'] = "function(form) { return #{[:with]} }" if [:with] function << (', ' + ()) unless .empty? function << ')' javascript_tag(function) end |
#in_place_editor_dropdown(object, method, tag_options = {}, in_place_editor_options = {}) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/smklib/somekool_scaffold.rb', line 43 def in_place_editor_dropdown(object, method, = {}, = {}) tag = ::ActionView::Helpers::InstanceTag.new(object, method, self) raise tag.inspect if [:crash] front_val = .delete(:front_val) = {:tag => "span", :id => "#{object}_#{method}_#{tag.object.id}_in_place_editor", :class => "in_place_editor_field"}.merge!() [:url] = [:url] || url_for({ :action => "set_#{object}_#{method}", :id => tag.object.id }) (front_val.to_s.empty? ? tag.to_content_tag(.delete(:tag), ) : tag.content_tag(.delete(:tag), front_val, )) + in_place_collection_dropdown([:id], ) end |