Rails Active Admin表单显示基于已检查的布尔值?

时间:2017-01-01 08:29:10

标签: ruby-on-rails activeadmin

我有一个简单的Active Admin表单,它显示了很多表单字段,但如果在该记录上检查了布尔值,则只需要一些表单字段。有没有办法让这些表单字段只显示一个布尔值?是否可以根据单元格中是否包含任何信息来显示表单?例如,从我的Active Admin页面:

form do |f|
  f.inputs do
    f.input :name
    f.input :active
    f.input :use_image  <---------------  this is a boolean
    if :use_image_boolean_is_clicked
       f.input :image_link  ## show form only after :use_image is clicked?
    end
    f.input :product_1  <---------------  this is a text field
    if :product_1_form_has_any_text_in_it 
       f.input :proudct_1_link  ## show form only after :product_1 has text in it?
    end
    f.input :product_2  <---------------  this is a text field
    if :product_2_form_has_any_text_in_it
       f.input :product_2_link  ## show form only after :product_2 has text in it?
    end
    f.input :text
    f.input :alt_text
 end
end

提前感谢您提供的任何帮助!

0 个答案:

没有答案