【问题标题】:Adding DatePicker Bootstrap and Centering Simple_Form_For添加 DatePicker Bootstrap 并居中 Simple_Form_For
【发布时间】:2014-03-21 19:42:13
【问题描述】:

这是我现在在 new_html_erb 中的表格。

We are doing a promotion for the next two weeks
<%= simple_form_for @subscription, :html => { :class => 'form-horizontal'} do |f| %>
    <%= f.input :manual_expiry_date %>
    <%= f.association :user %>
    <%= f.button :submit, :class => 'btn btn-primary'%>
<% end %>

我已经打开和关闭了 twitter bootstrap。我正在为 Rails 应用程序处理的表单正在使用引导程序。

如何将引导日期选择器添加到 manual_expiry_date ? 如何将我的 simple_form_for 居中?

我尝试将表单放入容器中,然后放置一行,然后将表单控件全部添加到 div 中。没有明显变化。我已经尝试将它作为一个类添加到 simple_form 但仍然相同。

感谢您的帮助。

【问题讨论】:

    标签: html css ruby-on-rails twitter-bootstrap


    【解决方案1】:

    Twitter Bootstrap 的核心没有日期选择器,购买可以使用 "DatePicker For Bootstrap" www.eyecon.ro/bootstrap-datepicker/

    你需要指定对象的类

    <%= f.input :manual_expiry_date, input_html: { class: 'date_picker' } %>
    

    然后

    $('.date_picker').datepicker()
    

    【讨论】:

    • 你的意思是$('.date_picker')
    猜你喜欢
    • 1970-01-01
    • 2019-06-10
    • 2023-03-06
    • 2013-01-20
    • 2018-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-05
    相关资源
    最近更新 更多