<%= f.label :title, class: "form-label" %>
<%= f.text_field :title,
class: "form-control",
placeholder: "Document Title",
readonly: is_mandatory %>
<% if is_mandatory %>
Mandatory document
<% end %>
<%= f.label :file, class: "form-label" %>
<% if has_file %>
📎 <%= f.object.file.filename %>
—
<%= link_to "Preview", url_for(f.object.file), target: "_blank", class: "text-decoration-none ms-1" %>
<% if f.object.file.image? %>
<%= image_tag f.object.file.variant(resize_to_limit: [220, 140]),
class: "img-thumbnail shadow-sm" %>
<% end %>
<% end %>
<%= f.file_field :file,
class: "form-control" %>
<% if is_mandatory %>
Upload is required
<% end %>
<% unless is_mandatory %>
<% end %>
<%= f.hidden_field :_destroy %>