<div
  id="modal-board-new"
  class="modal fade boards-modal"
  tabindex="-1"
  role="dialog"
  aria-labelledby="modal-board-header"
  aria-hidden="true"
>
  <div class="modal-dialog">
    <div class="modal-content">
      <%= simple_form_for [current_project, current_project.boards.build], html: { novalidate: false } do |f| %>
        <%= f.hidden_field(
              :node_id,
              value: @node.try(:id) || current_project.methodology_library.id) %>

        <div class="modal-header">
          <h5 class="modal-title" id="modal-board-header">Add new methodology</h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-hidden="true">
            <span class="visually-hidden">Close modal</span>
          </button>
        </div>

        <div class="modal-body">
          <div class="form-check">
            <%= radio_button_tag( "use_template", "no", true, { :class => 'form-check-input' }) %>
            <label class="form-check-label" for="use_template_no">Blank methodology</label>
          </div>

          <div class="form-check">
            <% @templates ||= [] %>
            <%= radio_button_tag("use_template", "yes", false, { disabled: @templates.empty?, :class => 'form-check-input', data: { behavior: 'use-template' } }) %>
            <label class="form-check-label <%= @templates.empty? ? "text-muted" : "" %>" for="use_template_yes">From template</label>
            <% if @templates.any? %>
              <div>
                <%= f.label :new_board_template, 'List of methodology templates', class: 'visually-hidden' %>
                <%= select_tag 'template', options_from_collection_for_select(@templates, :id, :name), class: 'my-1 form-select', id: 'board_new_board_template', data: { behavior: 'new-board-template' } %>
              </div>
            <% else %>
              <p class="mb-0">
                No methodology templates defined<br>
                Log in as admin: Templates > Methodologies
              </p>
            <% end %>
            <a href="https://dradis.com/academy/industry/compliance/"
              target="_blank">
              Download more templates
            </a>
          </div>

          <hr>
          <div class="mb-3">
            <%= f.input :name, required: true, input_html: { data: { behavior: 'new-board-name' }, id: 'new_board_name' } %>
          </div>
        </div>

        <div class="modal-footer">
          <input type="submit" value="Add methodology" class="btn btn-primary" />
          <button class="btn" type="button" data-bs-dismiss="modal" aria-hidden="true">Close</button>
        </div>
      <% end %>
    </div>
  </div>
</div>
