Rails best_in_place jQuery editing: activation button not working

I have a partial setup as follows:

<%= best_in_place_if can?(:edit, Artist), @artist, :display_name, type: :input, :activator => "#activator" %> <a href="#" id="activator">Edit</a> 

When I click the Edit link, nothing happens.

If I remove :activator => "#activator" from the best_in_place link, then it allows me to click on the text box to start editing as I expect; the only problem is that this does not work on the iPad, so I need a separate button to launch this editing function.

Does anyone know of a workaround for setting up the work :activator or other offer (including another stone) that they know will work for editing fields?

+4
source share
1 answer

Do you use partial listing of artists? Perhaps the identifier is not specific enough, so it gets confused, because there is an activator link with the identifier "activator", but at the same time there are several "activators". Try to clarify the identifier. Sort of:

 <%= best_in_place_if can?(:edit, Artist), @artist, :display_name, type: :input, :activator => "#activator-#{@artist.id}" %> <a href="#" id="activator-#{@artist.id}">Edit</a> 
+7
source

Source: https://habr.com/ru/post/1438236/


All Articles