Rails 5:form_for选择类的选择字段标签

时间:2019-01-17 11:33:45

标签: css ruby-on-rails

我目前正在尝试实现select_tag,我面临的问题是除select选项外,每个css元素都可以工作。当我使用f.select :home_type, [["Room", "Room"]], class: 'add-listing__input'

时会以某种方式调用引导样式表

此样式表会被调用,并且只能进行选择

http://localhost:3000/assets/triptip-assets.min.self-3157b4719675b23587e706840e28dab5a7506a2794b67521ade419a505a34070.css?body=1

例如,当我使用f.text_field时,一切正常,并且此样式表被调用

http://localhost:3000/assets/style.self-6fdbeaf8dfea504b6f923ccefbf5f6a7f370c6436cf98feefac201fc92c78f83.css?body=1

编辑

这是我的表格

  <%= form_for @room do |f| %>
    <div class="add-listing__form-content">
      <div class="row">
        <div class="col-md-6">
          <label class="add-listing__label">
            Home Type:
          </label>
          <%= f.select :home_type, [["Wohngebäude", "Wohngebäude"], ["Bürogebäude", "Bürogebäude"], ["Haus", "Haus"], ["Geschäft", "Geschäft"]], class: 'add-listing__input js-example-basic-multiple' %>
        </div>
        <div class="col-md-6">
          <label class="add-listing__label">
            Vacancy Type:
          </label>
          <%= f.select :vacancy_type, [["Leer", "Leer"], ["Voll", "Voll"]], class: 'add-listing__input js-example-basic-multiple' %>
        </div>
      </div>
      <div class="row">
        <div class="col-md-6">
          <label class="add-listing__label">
            Accomodate:
          </label>
          <%= f.number_field :accomodate, id: "amount", placeholder: "Für wie viele Personen?", class: "add-listing__input" %>
        </div>
        <div class="col-md-6">
          <label class="add-listing__label">
            Abrissgerüchte:
          </label>
          <%= f.text_field :rumors, id: "rumors", placeholder: "Abrissgerüchte?", class: "add-listing__input" %>
        </div>
      </div>

    </div>
  <% end %>

1 个答案:

答案 0 :(得分:1)

您应通过以下方式在选择字段中定义类:

carParts: {
  door: {
    xMin: 0.3,
    xMax: 0.4,
    yMin: 0.6,
    yMax: 0.72
  },
  hood: {
    xMin: etc,
  }
}