formtastic-bootstrap icon indicating copy to clipboard operation
formtastic-bootstrap copied to clipboard

Can't use FormBuilder.default_hint_class?

Open bunnymatic opened this issue 9 years ago • 1 comments

In our app we're putting in a ckeditor row like so (in slim templates):

= f.input :description, as: :ckeditor, hint: 'For best results...', input_html: { ckeditor: { toolbar: 'mini' } }

This fails when the CkEditorInput (a formtastic input from the ckeditor gem) calls for a hint:

def hint_html
  if hint?
    template.content_tag(
      :p, 
      Formtastic::Util.html_safe(hint_text), 
      class => builder.default_hint_class
    )
  end
end

After further digging, it seems that FormtasticBootstrap::FormBuilder raises (https://github.com/mjbellantoni/formtastic-bootstrap/blob/master/lib/formtastic-bootstrap/form_builder.rb#L22) ...

def self.default_hint_class
  # self.default_inline_hint_class
  raise
end

Is there a good reason for this raise? I got around the issue by monkey patching that method. But I'd rather not have to do that.

Also, seemingly strangely we have this line in the same form:

= f.input :price, as: :string, hint: 'in dollars without the $ sign.'

and it works just fine.

Thanks for any info.

Relevant Gems:

  • formtastic (3.1.3)
  • formtastic-bootstrap (3.1.0)
  • ckeditor (4.1.2)

bunnymatic avatar Jul 20 '15 21:07 bunnymatic

I'm afraid if there's a good reason for this, I do not remember what it is. It's most likely an oversight. Can you submit a patch?

mjbellantoni avatar Jul 23 '15 14:07 mjbellantoni