Rails_Admin - How to Resize a Text Box in the Publish View

The default height for the Mail body in Rails admin body area is fairly small. I am 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 
+6
source share
4 answers
 configure :description do html_attributes rows: 20, cols: 50 end 
+9
source

Another way to increase the length of a text field in Rails Admin is to:

 field :description, :text do html_attributes do {:maxlength => 600} end end 
+1
source

This has nothing to do with your model, what you need to do is change the CSS for this element. Many of the Rails engines tend to β€œhide” css from you, but it is often better to leave them alone and make changes to your own custom.css file (or custom.css.scss if you use SASS).

The easiest way is to look at the page in Chrome, right-click on the body element and when the pop-up menu appears, go to the Inspect Element item. The Chrome Developer Tools window opens and this item is highlighted. Look at the css class on the right to see what is called.

Go to your custom.css file and write a new version of this css class. You can use this exact name, but it's better to write your own class that is added to this particular html element, or you will redefine more than you want.

 input, textarea .yourclassname { height: 200px; } 

If something like this does not work. Add it! Important. (Better to leave it if you don't need it.)

 input, textarea .yourclassname { height: 200px !important; } 
0
source

in the case of a text field, you will do it as follows:

 field :permalink do { max_length: 1000 } end 

and in the case of the text area

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

As I did for my own site, i.e. https://www.wiki11.com Hope this helps you. Just remember, since text fields can only contain 255 characters, so they cannot go up to the width of the text area. To achieve the width of the text area, you will need to change the length of the character or make it text.

0
source

Source: https://habr.com/ru/post/925704/


All Articles