<% content_for :title, 'Methodologies' %>

<% content_for :breadcrumbs do %>
  <ol class="breadcrumb">
    <li class="breadcrumb-item">
      <%= link_to current_project.name, project_path(current_project) %>
    </li>
    <li class="breadcrumb-item active">
      Methodologies
    </li>
  </ol>
<% end %>

<%= render 'poller_alerts' unless  request.xhr? %>

<div class="content-container">
  <h4 class="header-underline">Methodologies
    <span class="actions pt-1">
      <a data-bs-toggle="modal" href="#modal-board-new">
        <i class="fa-solid fa-plus me-1"></i>New Methodology
      </a>
    </span>
  </h4>
  <% if @boards.any? %>
    <ul class="board-list">
      <% @boards.each do |board| %>
        <% content_for :board_rename_modal do %>
          <%= render partial: 'boards/modals/board_rename_form', locals: { board: board } %>
        <% end %>

        <li class="board-list-item" data-board-id="<%= board.id %>">
          <%= link_to main_app.project_board_path(current_project, board), class: 'board-tile' do %>
            <span class="board-tile-details">
              <span class="board-tile-details-name"><%= board.name %></span>
            </span>
          <% end %>

          <div class="board-actions">
            <%= link_to("#modal-board-edit-#{board.id}", data: { bs_toggle: 'modal' }) do %>
              <i class="fa-solid fa-pencil"></i> Edit
            <% end %>
            <%= link_to([current_project, board], class: 'text-error-hover', data: { confirm: "Are you sure?\n\nProceeding will delete this methodology from the project, as well as with any associated lists and tasks." }, method: 'delete') do %>
              <i class="fa-solid fa-trash"></i> Delete
            <% end %>
          </div>
        </li>
      <% end %>
    </ul>
  <% else %>
    <%= render 'shared/empty_state',
          actions_partial: 'boards/empty_state_actions',
          docs_link: 'https://dradis.com/support/guides/projects/methodologies.html',
          name: 'methodology',
          text: 'Drive consistency and quality by using a standard methodology for each assessment type.'
        %>
  <% end %>
</div>
