我正在使用rails-bootstrap-forms gem与devise form_tag [英] I am using rails-bootstrap-forms gem with devise form_tag

查看:151
本文介绍了我正在使用rails-bootstrap-forms gem与devise form_tag的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用rails-bootstrap-forms gem与devise。
我可以如何使用gem rails-bootstrap-forms自定义form_tag。
我的代码是

 <%= form_tag topic_posts_path(@topic)do%> 
<%= render'form'%>
<%= submit_tag'创建帖子'%>

<%end%>

而我的部分_form是

 < h2>创建新帖子< / h2> 


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

我想要一些类似

 < div class =form-group> 
< label for =xyz> xyz< / label>
< input type =emailclass =form-controlid =xyzplaceholder =输入xyz>
< / div>

任何帮助?

解决方案

所以你想要的是输入字段用< div class =form-group> ...< / div> 。将 form_tag 替换为 bootstrap_form_for 。将 text_area 替换为 f.text_area 。这就是您已经您的注册表单工作。


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 ?

解决方案

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.

这篇关于我正在使用rails-bootstrap-forms gem与devise form_tag的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆