Skip to content

Look into customizing Formtastic's HTML or replacing it #5070

@javierjulio

Description

@javierjulio

Its been quite painful to style Formtastic's HTML in #3862 that I'd like to update it to use a simpler component based approach like you see in Bootstrap or Foundation. I very much like Bootstrap's approach of using a form-control class instead of targeting HTML elements and applying defaults. Further styling fieldsets is incredibly painful across browsers. We have a panel component in #3862 which we should be reusing there. Or just using a different presentation for form headers.

We can customize the HTML output but it would require that we subclass each input class and override the input_wrapping method to use a new approach. Although the problem is that the fieldset_wrapper.rb helper generates not just the <fieldset> element but the <ol> as well which isn't good.

Further digging shows that form_builder.rb actually opens up the Formtastic::Inputs::Base module to override the input_wrapping method which for me was unexpected.

A good idea which could be quite challenging is switching to simple_form which is maintained and better documented. It has easier way of namespacing and customizing without having to subclass everything. It was built with customization in mind.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions