<%= bootstrap_form_with(model: link, data: { controller: "unsaved-changes" }) do |form| %>

  <div data-controller="check-link">
    <%= form.text_field :url, placeholder: "https://wikipedia.org", data: { "check-link-target": "input" } %>
    <%= link_to(link.url, link.url, target: "_blank", class: "mb-2", data: { "check-link-target": "button" }) %>
</div>

  <%= form.collection_select :link_category_id, LinkCategory.all.order(:name), :id, :name, include_blank: !link.persisted? %>
  <%= form.text_field :text %>
  <%= form.rich_text_area :description %>
  <%= form.submit %>
<% end %>
