"50", :inner_class => 'occupation-edit', -6ren">
gpt4 book ai didi

ruby-on-rails - 如何使用 Rails best_in_place 使文本框更宽?

转载 作者:行者123 更新时间:2023-12-05 00:27:25 29 4
gpt4 key购买 nike

我尝试使用以下方法执行此操作:

<%= 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” gem 进行自定义。

最佳答案

通过使用 html_attrs ,您可以设置这些类型的参数,如下所示:

<%= best_in_place current_user,
:blurb,
:type => :textarea,
:html_attrs => { :cols => '30', :rows => '50' }
%>

如果 rowscols属性不起作用,您可能想尝试 style属性,像这样:
<%= best_in_place current_user,
:blurb,
:type => :textarea,
:html_attrs => { :style => 'width:500px; height:500px;' }
%>

关于ruby-on-rails - 如何使用 Rails best_in_place 使文本框更宽?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20711622/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com