activeadminformtasticarbre

In Active Admin / Arbre form, how I can put HTML (specifically a line break) in a label?


This is a little unorthodox, but I don't think it should be difficult.

I have a Active Admin form:

form do |f|
  f.semantic_errors(*f.object.errors.keys)
  f.inputs do
    f.input :email
    f.input :name

    # read-only field that still matches formatting of form
    li do
      label "Last Update Time<br/>(except password changes)"
      div f.object.last_update_time
    end
  end
  f.actions
end

When rendered, the last_update_time label does not convert the <br/> into a line break. Similarly, html entity codes such as &copy; (the copyright (c)) aren't converted either.

How can I get html to render in that label?

Stuff I tried that doesn't work:

Anybody know the trick?


Solution

  • Try next:

    li do
      text_node "<label>Last Update Time<br/>(except password changes)"</label>".html_safe
      div f.object.last_update_time 
    end
    

    &copy; must be inside a text_node too like:

    text_node "&copy;".html_safe