首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Rails:检查Formtastic (启动)

Rails:检查Formtastic (启动)
EN

Stack Overflow用户
提问于 2012-11-16 00:41:53
回答 1查看 926关注 0票数 0

问题:在哪里可以为表单找到/编辑原始的css文件?

原因:i不能更改文本窗体的“宽度”,因为它们似乎被自动设置为某个值。如果原始css文件强制所有文本窗体的宽度,我想检查它。

环境:

代码语言:javascript
复制
group :assets do
 gem 'sass-rails',   '~> 3.2.3'
 gem 'coffee-rails', '~> 3.2.1'
 gem 'bootstrap-sass'
 gem 'formtastic-bootstrap'

如果有人知道为什么我不能改变文本表单的宽度(大小,cols属性不起作用)的直接答案,我会更感激这个答案。谢谢你的帮助!

图像:

_form.html.erb

代码语言:javascript
复制
 <% @post = Post.new %>
 <%= semantic_form_for @post do |f| %>
  <%= f.inputs do %>
    <%= f.input :name, :hint => "enter your name", :input_html => { :rows => 10, :width => 10 } %>
    <%= f.input :content, :hint => "enter the content", :input_html => { :rows => 10, :width => 100000 } %>

<% end %>
<%= f.actions do %>
    <%= f.action :submit, :as => :button %>
    <%= f.action :cancel, :as => :link %>
<% end %><% end %></div>

HTML:

代码语言:javascript
复制
<form accept-charset="UTF-8" action="/posts" class="formtastic post" id="new_post" method="post" novalidate="novalidate"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="wFcjDR0nzm2B3yl2XtUxzlQz0CWplYf2nKiq+xgDpXo=" /></div>

<fieldset class="inputs">
<div class="string input required stringish control-group" id="post_name_input"><label class=" control-label" for="post_name">Name<abbr title="required">*</abbr></label><div class="controls"><input id="post_name" maxlength="255" name="post[name]" rows="10" type="text" width="10" /><span class="help-block">enter your name</span></div></div>

<div class="text input required control-group" id="post_content_input"><label class=" control-label" for="post_content">Content<abbr title="required">*</abbr></label><div class="controls"><textarea id="post_content" name="post[content]" rows="10" width="100000"></textarea><span class="help-block">enter the content</span></div></div></fieldset>

摘要:为什么会发生这种情况,在哪里可以找到formtastc.css文件?它不在“资产”文件夹中,但页面正在以某种方式加载css。

EN

回答 1

Stack Overflow用户

发布于 2012-11-17 09:22:49

Formtastic.css文件位于开发人员的资产中(它在gem中,所以您不能在Windows中检查它。

Formtastic.css

在这里,下面的代码引起了麻烦

代码语言:javascript
复制
/* TEXTAREA OVERRIDES
---------------------------------------------------------------------------------*/
.formtastic .text textarea {
  width:72%;
}

.formtastic .text textarea[cols] {
  width:auto;
  max-width:72%;
}

我只是通过使用类span来解决这个问题,而不是试图修复宽度。但是你可以添加你自己的css来改变宽度,在我看来,这会带来同样的结果。

代码语言:javascript
复制
<%= f.input :content, :label => 'content', :input_html => {  :rows => 5, :class => 'span10' } %>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13408747

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档