Reputation: 6381
I have a Rails app and am using haml and bootstrap. One my form I have two fields for entering text, and only one is displayed, depending on a variable I set in the controller. If there is a text area I would like to size it, and the :rows attribute works but not columns.
I have also tried to use %div :class => 'span6' to widen the text_area, but it doesn't seem to work.
= form_for [@lesson_layout, @layout_field] do |f|
.field
= f.label :field_name
= f.text_field :field_name
- case @layout_type
- when "Text Field"
.field
= f.label :field_value
= f.text_field :field_value
- when "Text Area"
.field
= f.label :field_value_long
= f.text_area :field_value_long, :rows => 5, :placeholder => 'Enter text.'
.actions
= f.submit
EDIT
Tried the following code, and it did not change the size of the box.
.field
= f.label :field_value_long
= f.text_area :field_value_long, :rows => 5, :placeholder => 'Enter text using markdown.', :html => { :style => "width:300em" }
Upvotes: 0
Views: 6785
Reputation: 33217
f.text_area(
:field_value_long,
:rows => 5,
:placeholder => 'Enter text.',
:html => { :style => "width:20em !important" }
)
OR
f.text_area(
:field_value_long,
:rows => 5,
:placeholder => 'Enter text.',
:html => { :class => "my_wide_class" }
)
Upvotes: 1
Reputation: 2964
Something like this should work :
= f.text_area :field_value_long, :rows => 5, :class => "span6", :placeholder => 'Enter text.'
Upvotes: 11