samedi 13 juin 2015

Hide label in certain resolution with simple_form

I have this wrapper in simple_forms

config.wrappers :styled_horizontal_boolean3, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
  b.use :html5
  b.optional :readonly
  b.use :label, class: 'hidden-sm hidden-xs col-md-3 control-label'

  b.wrapper tag: 'div', class: 'col-md-9 checkbox-margin' do |wr|
    wr.wrapper tag: 'div', class: 'styled checkbox' do |ba|
      ba.use :label_span_input, class: 'col-md-9', span_class: 'left'
    end

    wr.use :error, wrap_with: { tag: 'span', class: 'help-block' }
    wr.use :hint,  wrap_with: { tag: 'span', class: 'help-block' }
  end
end

This will hide the control-label at lower resolutions, which is great, see screenshot:

Lower resolution

But I need to find a way to hide the label of the checkbox at larger resolutions, otherwise it's rendered twice, see screenshot:

Higher resolution

Aucun commentaire:

Enregistrer un commentaire