Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display checkbox best_in_place ruby gem

I am using the best_in_place gem in a project, and i am trying to display a checkbox on it's own place, but i cannot do it. I am searching about it, but i cannot find out the answer anywhere. I just can find people talking about display either "no" or "yes"... Or anything else. But i just want to see the checkbox checked or not.

like image 357
Victor Augusto Avatar asked Mar 28 '12 04:03

Victor Augusto


1 Answers

I am using font-awesome but you can use it also with bootstrap or other images. My solution for displaying checkboxes were simply using the raw method to render a checkbox image (in my case one of the font-awesome icons)

= best_in_place @project, 
    :active, 
    :type => :checkbox, 
    :collection => {false: raw("<i class='icon-check-empty'></i>"), true: raw("<i class='icon-check'></i>")}

And now it looks like the following:

best_in_place with checkboxes

like image 96
anka Avatar answered Oct 13 '22 05:10

anka