2015-05-12 78 views
2

我有我從railscasts得到這個簡單的Postgres搜索表單:轉換simple_form標籤來引導

%h2 
     Search textbook title or ISBN 
    = simple_form_for books_path, method: :get do 
     = search_field_tag :query, params[:query] 
     = submit_tag "Search", name: nil 

和自舉搜索形式(HAML):

.featurette 
.featurette-inner.text-center 
    %form.search{:role => "form"} 
     %h3.no-margin-top.h1 Search Me. 
     .input-group.input-group-lg 
      %input.form-control{:placeholder => "search", :type => "search"} 
       %span.input-group-btn 
        %button.btn.btn-primary{:type => "submit"} Search 

我想爲「search_field_tag成爲」input.form-control「和」submit_tag「成爲」button.btn.btn-primary「。

需要你們的幫助,因爲我無法進行搜索和T他提交按鈕工作。剛剛開始像2周的軌道。任何支持非常感謝。

謝謝!

+0

你看過[simple_form-b​​ootstrap](http://simple-form-b​​ootstrap.plataformatec.com.br/)嗎? – Jon

+0

現在看着它。一會兒會回來的 –

回答

0

@Jon我仍然不明白我在做什麼,並使用f.input而不是= search_field_tag只是給了我一個錯誤。我能夠讓它工作。以下是我用過的:

.featurette 
.featurette-inner.text-center 
    %form.search{:role => "form"} 
     %h3.no-margin-top.h1 Search Me. 
     = simple_form_for books_path, method: :get do 
      .input-group.input-group-lg 
       = search_field_tag :query, params[:query], class: "form-control" 
       %span.input-group-btn 
        = submit_tag "Search", name: nil, class: "btn btn-success"