Simple_form&Twitter Bootstrap:表单标签未对齐,生产中缺少HTML?
当我投入生产时,我的形式发生变化,导致标签和字段彼此未对齐。在开发中它可以正常工作,但不能用于生产。Simple_form&Twitter Bootstrap:表单标签未对齐,生产中缺少HTML?
这里是我的意思是:
Development
<div class="control-group string required">
<div class="control-label">
<label for="store_business_name" class="string required">
<abbr title="required">
*
</abbr> Business
</label>
</div>
<div class="controls">
<input type="text" size="50" name="store[business_name]" id="store_business_name" class="string required span3">
<p class="help-block">
The Business the store will belong to
</p>
</div>
</div>
Production
<div class="control-group string required">
<label for="store_business_name" class="string required">
<abbr title="required">
*
</abbr> Business
</label>
<div class="controls">
<input type="text" size="50" name="store[business_name]" id="store_business_name" class="string required span3">
<p class="help-block">
The Business the store will belong to
</p>
</div>
</div>
如果你仔细一看,<div class="control-label">
消失生产。我没有使用任何类型的引导宝石(取决于我无法安装的宝石)。这是一个已知的问题,这是如何解决的?
<%= simple_form_for(@store, :html => { :class => 'form-horizontal' }) do |f| %>
<%= render :partial => "shared/error_message", :locals => { :f => f } %>
<div class="span12">
<%= f.input :business_name, :label => 'Business', :input_html => { :class => "span3" }, :hint => "The Business the store will belong to" %>
<%= f.input :online_store, :label => 'Online Store', :as => :boolean %>
<%= f.input :address, :input_html => { :class => "span3" }, :placeholder => "451 University Avenue, Palo Alto, CA 94301", :hint => "For offline store" %>
<%= f.input :website, :input_html => { :class => "span3" }, :placeholder => "www.somewebsite.com", :hint => "For online store" %>
<%= f.input :phone_number, :input_html => { :class => "span3" }, :placeholder => "(650) 798-2800" %>
<div class="form-actions">
<%= f.button :submit, "Done", :class => 'btn btn-primary span2' %>
</div>
</div>
<% end %>
您正在使用什么版本Simple_form的?你是如何整合自举的?
假设你使用simple_form的维基与Twitter /引导整合,那么请验证:
- 的lib/simple_form/contained_input_component.rb被加载并实现,是
- 配置/初始化/ simple_form。 RB是在调用上述库
- 仅存在一个在配置/初始化和配置/生产
simple_form.rb如果所有的上面是在或请使用您的查看代码更新问题。
这是一个与宝石问题。我正在使用2.0.0.rc.我升级到2.0.1,现在一切都很好。谢谢你的关心。 – LearningRoR 2012-03-07 16:36:46
@Railslearner:不用担心,在附注中 - 总是在集成任何新gem并在Gemfile中显式定义gem版本时检查最新的稳定版本。出血边缘是家庭实验,秘密实验室和错误测试者:P – 2012-03-07 16:44:02
您可以通过生成此输出的视图吗?你确定你的代码在env中是一样的吗? – shingara 2012-03-07 14:26:15