bernat / best_in_place

A RESTful unobtrusive jQuery Inplace-Editor and a helper as a Rails Gem
http://blog.bernatfarrero.com/in-place-editing-with-javascript-jquery-and-rails-3/
1.2k stars 571 forks source link

Refresh Needed to Display (Not the obvious problem) #498

Open drdevnull opened 9 years ago

drdevnull commented 9 years ago

I was having an issue with requiring a refresh for best_in_place to show '-' or placeholders on nil elements.

Looks like it is a turbolinks issue.

$(document).ready(function() { /* Activating Best In Place */ jQuery(".best_in_place").best_in_place(); });

Is not running at every page load. (I had this placed on application.js...)

Instead, recommend changing this snippet on your instructions page to:

$(document).on('ready page:load', function () { /* Activating Best In Place */ $(".best_in_place").best_in_place(); });

dstull commented 9 years ago

same issue - have to table cells in a row being rewritten by remote js using best in place. the 2nd cell wasn't getting best_in_place loaded. Adding this as the final line in my js.erb file fixed it:

$(".best_in_place").best_in_place();