简体   繁体   English

具有Bootstrap的Simple_form:以水平形式创建2个内联字段

[英]Simple_form with Bootstrap: create 2 inline fields in a horizontal form

I am trying to create 2 inline fields (minimum age and maximum age fields) in a generally horizontal form but nothing is working. 我正在尝试以通常水平的形式创建2个内联字段(最小年龄和最大年龄字段),但是没有任何作用。

=simple_form_for([:admin, @group], :html => {:class => 'form-horizontal', :remote => true },  wrapper: :horizontal_form, wrapper_mappings: {check_boxes: :horizontal_radio_and_checkboxes, radio_buttons: :horizontal_radio_and_checkboxes, file: :horizontal_file_input, boolean: :horizontal_boolean}, ) do |f|
  =f.input :title
  =f.input :desc, :label => "Description"
  =f.input :minimum_age,:wrapper_html => { :style => 'display: inline !important' }
  =f.input :maximum_age, :wrapper_html => { :style => 'display: inline !important' }
  =f.input :include_null_birthday, as: :radio_buttons, label_html: {data: {toggle: "tooltip", title: "Some comment.", placement: "right"}}, label: "Include people with no birthday set [?]"

Does anyone know how this can be done? 有谁知道该怎么做?

It's a bit late but as this one is easy : 有点晚了,但是因为这个很容易:

    <div class="button-inline">
      <%= f.input :minimum_age,:wrapper_html %>
      <%= f.input :maximum_age, :wrapper_html %>
    </div>

In your css : 在您的CSS中:

    .button-inline {
      display: flex;
      justify-content: space-between;
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM