Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def add_new_procedure_fields(name)
- link_to_function name do |page|
- page << "index = $$('#procedures .procedure').length;"
- page.insert_html :bottom, :procedures, :partial => 'actual_procedures/form', :locals => {:add_auto_complete => false}
- page << "stale = $$('#procedures .procedure').last();"
- page << "fresh = stale.innerHTML.gsub('_0', '_' + index).gsub('[0]', '[' + index + ']');"
- page << "stale.update(fresh);"
- function = "new Ajax.Autocompleter("
- function << "'terms_' + index, "
- function << "'terms_' + index + '_auto_complete', "
- function << "'#{auto_complete_procedures_path}', "
- function << "{paramName: 'terms', parameters:'authenticity_token=' + encodeURIComponent('89f0d5534cf4bc7a852e2ae2a41d07682ae68023'), select:'procedure_name'})"
- page << function
- end
- end
Add Comment
Please, Sign In to add comment