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

时间:2015-02-12 17:37:17

标签: ruby-on-rails ruby-on-rails-4 simple-form simple-form-for

我试图以一般水平的形式创建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 [?]"

有谁知道如何做到这一点?

1 个答案:

答案 0 :(得分:0)

有点晚了,但这个很容易:

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

在你的css中:

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