Reputation: 1549
I used the gem in a project before, only it was rails 3 with no css framework. Now it seems like jQuery functions for best_in_place are eather blocked or not loaded at all. There's no placeholder visible from :nil function and no editing current values available neither.
This is my view partial:
<div class="row">
<div class="col-lg-4">
<%= best_in_place [@company,service], :name, type: :input, :nil => "Click to fill" %>
</div>
<div class="col-lg-4">
<%= best_in_place [@company,service], :duration, type: :input, :nil => "Click to fill" %>
</div>
<div class="col-lg-4">
<%= link_to 'X', [@company,service], method: :delete, data: { confirm: 'Are you sure?'} %>
</div>
</div>
My controller:
def update
respond_to do |format|
if @service.update(service_params)
format.html { redirect_to @service, notice: 'Service was successfully updated.' }
format.json { respond_with_bip(@service) }
else
format.html { render :edit }
format.json { render json: @service.errors, status: :unprocessable_entity }
end
end
end
service.js.coffee for activating jquery best_in_place functions
jQuery ->
$('.best_in_place').best_in_place()
And application.js
//= require jquery
//= require jquery_ujs
//= require jquery_nested_form
//= require turbolinks
//= require bootstrap.min
//= require jquery-ui
//= require jquery.purr
//= require best_in_place
//= require best_in_place.jquery-ui
//= require_tree
I noticed also the last update on best_in_place is from 02/2013, so maybe it's not fully compatible with my present project. If that's the case i'd appreciate any data on similar gems to be used instead.
Edit:
It's clearly a javascript issue but i can't figure it out. I get the following error on my browser console:
"undefined is not a function".
Only it points at jquery.js line 10306, which is empty ..
Upvotes: 4
Views: 983
Reputation: 3722
it seems, like you forgot add class .best_in_place
<div class="row">
<div class="best_in_place col-lg-4">
<%= best_in_place [@company,service], :name, type: :input, :nil => "Click to fill" %>
</div>
<div class="col-lg-4">
...........
Upvotes: 0