0

I'm trying to show some popovers in a form I am currently building. They should appear when the user has focus on a specific field, but I can't quite manage to do so, here is what I got (in Slim):

#sample_form=simple_form_for sample do |form|
    =form.input :sample_name, placeholder: "Name", rel="popover" data-content="content" data-original-title="title"

javascript:
    $('#sample_form input').hover(function()
        {
            $(this).popover('show')
        });

And here is what I get when I try to load the page:

..._form.html.slim:4: syntax error, unexpected tIDENTIFIER, expecting tASSOC
...", rel="popover" data-content="lol" data-original-...
...                     ^
..._form.html.slim:4: syntax error, unexpected tIDENTIFIER, expecting ')'
...opover" data-content="content" data-original-title="title"))).to_...
...                                   ^

Probably a simple syntax mistake but I can't figure it out.

Thanks in advance.

Andrei Botalov
  • 20,686
  • 11
  • 89
  • 123
Heartcroft
  • 1,672
  • 2
  • 19
  • 31

1 Answers1

3

The problem is that you are mixing Slim and Ruby together on the second line. Try something like this instead:

= form.input :sample_name, placeholder: "Name", :input_html => {:rel => "popover", :data => {:content => "content", "original-title" => "title"}}
Jiří Pospíšil
  • 14,296
  • 2
  • 41
  • 52