输出在simple_form的中间

问题描述 投票:0回答:1

我有一个simple_form使用simple_form_for。它工作正常。

我想添加一行看起来像:

锁定?真正

在中间。我可以用它来制作它:

= f.label "Locked?"
= f.label @client.access_locked?

但是,这并没有增加新的一行,并且其他所有内容都会混乱。

我想要相当于f.input行,除了它的输出而不是输入:

= f.output label: "Locked?", value: @client.access_locked?

或者其他的东西。我该怎么做呢?

编辑:

目前,我有这个:

= simple_form_for @client, :url => admin_client_path(@client) do |f|
  = f.input :email, :input_html => {:autocomplete => "off"}
  .user_profile
    %dl
      %dt Locked
      %dd=  @client.access_locked?
  = f.button :submit, 'Update', :class => 'button'

产生这个:

enter image description here

我想要排好队......但这是我迄今为止最好的......

ruby-on-rails haml simple-form-for
1个回答
0
投票

你试过引导类form-control-static吗?见https://www.w3schools.com/bootstrap/bootstrap_forms_inputs2.asp

© www.soinside.com 2019 - 2024. All rights reserved.