<%= bootstrap_form_with model: [releasable, tag] do |form| %>
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">Manage tags for <%= releasable.name %></h5>
        <%= button_tag type: "button", class: "close", data: { dismiss: "modal" }, aria: { label: "Close" } do %>
          <span aria-hidden="true">&times;</span>
        <% end %>
      </div>
      <div class="modal-body">
        <%= errors_summary_for releasable %>

        <%= form.text_field :name, hide_label: true, placeholder: "Tag name", append: form.submit(t(".submit"), class: "btn btn-primary", data: { disable_with: t("shared.disable_with") }) %>
        <hr/>
        <table class="table-sm table-borderless">
          <thead>
            <tr>
              <th scope="col"></th>
              <th scope="col"></th>
            </tr>
          </thead>
          <tbody class="tag-list">
            <% releasable.tags.each do |tag| %>
              <% unless tag.new_record? %>
                <tr id="<%= dom_id(tag) %>">
                  <td><%= fa_icon("tags fw", text: tag.name) %></td>
                  <td><small><%= link_to "Remove", [releasable, tag], method: :delete, remote: true %></small></td>
                </tr>
              <% end %>
            <% end %>
          </tbody>
        </table>
      </div>
      <div class="modal-footer">
        <%= form.button "Close", class: "btn btn-secondary", type: "button", data: { dismiss: "modal" } %>
      </div>
    </div>
  </div>
<% end %>