simple_form collection wrapper (radios buttons) : double encapsulation of items

后端 未结 3 969
醉话见心
醉话见心 2021-02-15 12:57

I\'d like to reproduce this html sequence of radio buttons with simple_form in order to make simple_form work with http://semantic-ui.com/ syntax :

  
3条回答
  •  深忆病人
    2021-02-15 13:50

    I was having trouble with the same problem until I looked through config/initializers/simple_form.rb.

    Turns out you can set the option here (line ~51):

    # Define the way to render check boxes / radio buttons with labels.
    # Defaults to :nested for bootstrap config.
    #   inline: input + label
    #   nested: label > input
    config.boolean_style = :inline
    

    A bit further down you can also define the default wrapper tag and wrapper tag class for the collection (line ~81):

     # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
     config.collection_wrapper_tag = :div
    
     # You can define the class to use on all collection wrappers. Defaulting to none.
     config.collection_wrapper_class = 'styled-radios'
    

    Hope this helps someone :)

    *using gem 'simple_form'

提交回复
热议问题