ruby-on-rails – 如何使用Rails best_in_place使文本框更宽?
发布时间:2020-12-17 03:06:21 所属栏目:百科 来源:网络整理
导读:我尝试过以下操作: %= current_user.first_name %%= current_user.last_name %span class="bubble" %= best_in_place current_user,:blurb,type: :textarea,:cols = "30",:rows = "50",:inner_class = 'occupation-edit',nil: 'Add a short blurb (max 140)
我尝试过以下操作:
<%= current_user.first_name %> <%= current_user.last_name %> <span class="bubble"> <%= best_in_place current_user,:blurb,type: :textarea,:cols => "30",:rows => "50",:inner_class => 'occupation-edit',nil: 'Add a short blurb (max 140)' %> </span> 但是,这不起作用.是否可以将文本区域设置为垂直长度?看起来它不能用’best_in_place’宝石定制. 解决方法
通过使用
html_attrs ,您可以设置这些类型的参数,如下所示:
<%= best_in_place current_user,:type => :textarea,:html_attrs => { :cols => '30',:rows => '50' } %> 如果rows和cols属性不起作用,您可能想尝试style属性,如下所示: <%= best_in_place current_user,:html_attrs => { :style => 'width:500px; height:500px;' } %> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |