Rails_Admin - 如何在Post视图中更改文本字段的大小

时间:2012-09-18 18:45:47

标签: ruby-on-rails ruby rails-admin

Rails Admin中Post的“body”上输入区域的默认高度非常小。我正在试图弄清楚如何增加身高。有什么建议?

config.model Post do
 label 'Blog'
 weight 0
 edit do
   field :user
   field :title
   field :body_format
   field :body do 
     (something here?)
  end

3 个答案:

答案 0 :(得分:10)

configure :description do
  html_attributes rows: 20, cols: 50
end

答案 1 :(得分:3)

增加Rails Admin中文本字段长度的另一种方法是:

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

答案 2 :(得分:1)

如果是文字字段,你会这样做

class allListsCell: UITableViewCell {

    @IBOutlet var cellLable:       UIView!
    @IBOutlet var cellSelected:    UILabel!
    var colorIndex = Int()        

    @IBAction func cellMarkButton(_ sender: UIButton, forEvent event: UIEvent) {
        if  colors[self.colorIndex].selected == false {
            colors[self.colorIndex].selected = true
            cellSelected.text = "•"

            let alertController = UIAlertController(title: "???", message: "alertA", preferredStyle: .alert)

            let OKAction = UIAlertAction(title: "dismiss", style: .default) { (action:UIAlertAction!) in
                print("Sand: you have pressed the Dismiss button");
            }
            alertController.addAction(OKAction)

            present(alertController, animated: true, completion: nil) // ERROR

        } else {
            colors[self.colorIndex].selected = false
            cellSelected.text = ""
        }
    }

以及文字区域

field :permalink do
  { max_length: 1000 }
end

正如我为自己的网站所做的那样https://www.wiki11.com 希望这会对你有所帮助。请记住,因为文本字段只能包含255个字符,所以它无法达到文本区域的宽度。为了达到文本区域宽度,您需要更改其字符长度或使其成为文本区域。