为什么输入组中的twitter bootstrap按钮在我的rails应用程序中看起来有问题?

时间:2015-02-18 12:16:46

标签: ruby-on-rails twitter-bootstrap

我是一个rails和bootstrap初学者,并且非常努力地获得我的程序中描述的输入组:

http://getbootstrap.com/components/#input-groups (请向下滚动到"按钮插件")

我试图在may rails程序中做到这一点,但它看起来完全不同(和错误):

Button not aligned, wrong colour

我在视图中的代码:

<%- model_class = Score -%>
<%= form_tag scores_path, :method => 'get' do %>
<div class="row">
  <div class="col-lg-6">
    <div class="input-group">
      <span class="input-group-btn">
        <%= button_tag t(:search), :name => nil, class: ["btn","btn-    default"] %>
      </span>
      <%= text_field_tag :search, params[:search], class: "form-control",     placeholder: "Search for..." %>
    </div> <!-- input-group -->
  </div> <!-- col-lg-6 -->
</div> <!-- row -->
<% end %>

<div class="page-header">
  <h1><%= t( :list_model, model: Score.model_name.human( :count => 2) )%> (<%= Score.count%>) </h1>
</div>

那就是生成的html:

  <div class="container">
    <div class="row">
      <div class="span12">
          <form accept-charset="UTF-8" action="/scores" method="get"><div     style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden"     value="&#x2713;" /></div>
<div class="row">
  <div class="col-lg-6">
    <div class="input-group">
      <span class="input-group-btn">
        <button class="btn btn-default" type="submit">Suchen</button>
      </span>
      <input class="form-control" id="search" name="search"     placeholder="Search for..." type="text" />
    </div> <!-- input-group -->
  </div> <!-- col-lg-6 -->
</div> <!-- row -->
</form>
<div class="page-header">
  <h1>Liste der Stücke (103) </h1>
</div>

我正在使用twitter-bootsrap gem:

% bundle show twitter-bootstrap
/var/lib/gems/1.9.1/gems/twitter-bootstrap-rails-2.2.8
嗯,2.2.8?这是gem-version还是bootstrap版本?在每种情况下,它都以某种方式出错:主页提到了宝石的3.2版本?!

https://github.com/seyhunak/twitter-bootstrap-rails

尝试例子时,例如在http://www.w3schools.com/bootstrap/tryit.asp中,一切看起来都很好,所以它必须是我的程序,但我不知道在哪里看:(

更新:标题中包含的内容:

% wget -q -O- "http://localhost:3000/scores" | grep -i bootstrap
<link data-turbolinks-track="true"     href="/assets/bootstrap_and_overrides.css?body=1" media="all"     rel="stylesheet" />
<script data-turbolinks-track="true"     src="/assets/twitter/bootstrap/bootstrap-transition.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/twitter/bootstrap/bootstrap-alert.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/twitter/bootstrap/bootstrap-modal.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/twitter/bootstrap/bootstrap-dropdown.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/twitter/bootstrap/bootstrap-scrollspy.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/twitter/bootstrap/bootstrap-tab.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/twitter/bootstrap/bootstrap-tooltip.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/twitter/bootstrap/bootstrap-popover.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/twitter/bootstrap/bootstrap-button.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/twitter/bootstrap/bootstrap-collapse.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/twitter/bootstrap/bootstrap-carousel.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/twitter/bootstrap/bootstrap-typeahead.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/twitter/bootstrap/bootstrap-affix.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/twitter/bootstrap.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/bootstrap.js?body=1">    </script>

0 个答案:

没有答案