var modalSelector = "#tag_multiple_releases"
var modal = "<%= j render("new_bulk_tag_modal", releasable_ids: @releasable_ids, releasable_name: @releasable_name, project_id: @project.id) %>"

// If the modal already exists, replace it. Otherwise, create it
if ($(modalSelector).length > 0) {
  $(modalSelector).replaceWith(modal)
} else {
  $('body').append(modal)
}

$(modalSelector).modal("toggle")