<%
  title = "Search Results"
  title << ": #{params[:q]}" if params[:q].present?
%>

<% content_for :title, title %>

<ol class="breadcrumb">
  <li class="breadcrumb-item">
    <%= link_to current_project.name, project_path(current_project) %>
  </li>
  <li class="breadcrumb-item active">
    <%= title %>
  </li>
</ol>

<% if params[:q].blank? %>
  <div class="content-container">
    <div class="alert alert-info m-0">
      <p class="m-0">Please enter search criteria</p>
    </div>

    <br/>

    <%= form_tag project_search_path(current_project), method: :get, class: 'form' do %>
      <div class="inset-button-wrapper">
        <%= search_field_tag :q,  params[:q], placeholder: 'Search here...', class: 'search-query form-control' %>
        <button type="submit" class="btn btn-primary">Search</button>
      </div>
    <% end %>
  </div>

<% else %>
  <%= render 'nav', search: @search %>
  <div class="content-container">
    <%= render 'results', search: @search %>
  </div>
<% end %>
