Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails_Admin - How to change size of text field in the Post view

The default height for the input area on the "body" of a Post in Rails Admin is pretty small. I'm trying to figure out how to increase the height. Any suggestions?

config.model Post do
 label 'Blog'
 weight 0
 edit do
   field :user
   field :title
   field :body_format
   field :body do 
     (something here?)
  end
like image 936
user1300897 Avatar asked Sep 18 '12 18:09

user1300897


3 Answers

configure :description do
  html_attributes rows: 20, cols: 50
end
like image 161
Andrey Sitnik Avatar answered Sep 19 '22 09:09

Andrey Sitnik


Another way of increasing the length of the text field in Rails Admin is:

field :description, :text do
  html_attributes do
    {:maxlength => 600}
  end
end
like image 31
K M Rakibul Islam Avatar answered Sep 21 '22 09:09

K M Rakibul Islam


in case of text field, you will do like this

field :permalink do
  { max_length: 1000 }
end

and in case of text area

field :description do
  html_attributes rows: 5, cols: 100
end

As I have done for my own website i.e. https://www.wiki11.com Hopefully, this will help you. Just remember, since text fields can contain 255 characters only, so it cant go upto text area's width. In order to reach up to text area width, you will need to change its character's length or make it text area.

like image 25
Neeraj Kumar Avatar answered Sep 19 '22 09:09

Neeraj Kumar