Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In place editor with autocomplete

Has anyone been able to do this? Is it possible? I'm writing a Rails 3 app, and it seems like it should be possible to do this with jquery autocomplete and best-in-place, but I haven't seen it.

like image 463
John H Avatar asked Mar 25 '12 22:03

John H


2 Answers

Too late for reply, but... I've just encountered with similar task and solved this problem like that:

#view
best_in_place @somewhat, :title, type: :input, inner_class: 'somewhat_title', 
  ok_button: 'ok', data: { autocomplete: true }

#coffee
$("span[data-autocomplete='true']").live 'click', ->
  $('.somewhat_title').autocomplete
    #usual autocomplete code here, nothing special
like image 195
Mik Avatar answered Sep 29 '22 09:09

Mik


I used rails3-jquery-autocomplete. In view it'll be something like:

best_in_place @object, :name, :type => :input, 
  html_attrs: { "data-autocomplete" => your_autocomplete_path }
like image 45
Aleks Avatar answered Sep 29 '22 08:09

Aleks