Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
220 views
in Technique[技术] by (71.8m points)

I am using rails-bootstrap-forms gem with devise form_tag

I am using rails-bootstrap-forms gem with devise. How i can customize form_tag with bootstrap with gem rails-bootstrap-forms. My code is

<%= form_tag topic_posts_path(@topic) do %>
    <%= render 'form' %>
    <%= submit_tag 'Create post' %>

<%end%>

and my partial _form is

    <h2>Create new post</h2>


    <%= label :post, :description %>
    <%= text_area :post, :description %>

I want something like

<div class="form-group">
    <label for="xyz">xyz</label>
    <input type="email" class="form-control" id="xyz" placeholder="Enter xyz">
  </div>

any help ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

So what you want is to have input fields wrapped with <div class="form-group">...</div>. Replace form_tag with bootstrap_form_for. Replace text_area with f.text_area. That's how you already got your signup form work.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...