Sonny Black
Sonny Black

Reputation: 1617

How to make a text box wider using Rails best_in_place?

I've tried doing this with the following:

<%= 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>

However, this isn't working. Is it possible to make the text area longer as in vertical length? It seems like it's not customizable with the 'best_in_place' gem.

Upvotes: 4

Views: 1279

Answers (1)

summea
summea

Reputation: 7593

By using html_attrs, you can set those types of parameters, like this:

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

And if the rows and cols attributes don't work, you might want to try the style attribute, like this:

<%= best_in_place current_user,
      :blurb,
      :type => :textarea,
      :html_attrs => { :style => 'width:500px; height:500px;' }
%>

Upvotes: 6

Related Questions