var hideConfirmed = $("input[name=hide_confirmed]:checked").length > 0;

// Mark the release as confirmed
if (<%= @releasable.respond_to?(:file_infos) %>) {
  $("[data-ujs-target=<%= dom_id(@releasable, "file_info_#{@video_release_confirmation.file_info_id}") %>]").attr("data-confirmed", true).data("confirmed", true)
} else {
  $("#<%= dom_id(@releasable) %>").attr("data-confirmed", true).data("confirmed", true)
}

// Hide if necessary
$("#appearance_releases_section #<%= dom_id(@releasable) %>").attr("data-hidden", hideConfirmed).data("hidden", hideConfirmed);

// Refresh the confirmed releases list
$("#video_release_confirmations").html("<%= j render("video_analyses/video_release_confirmations", video_release_confirmations: @video_release_confirmations) %>");

// Close and remove the modal
$("#new_video_release_confirmation_modal").on("hidden.bs.modal", function (e) {
  $("#new_video_release_confirmation_modal").remove();
});
$("#new_video_release_confirmation_modal").modal("hide");
