<div class="contextual">
<%= link_to icon_with_label('add', l(:label_project_new)), new_project_path, :class => 'icon icon-add' %>
</div>

<h2><%= @query.new_record? ? l(:label_project_plural) : @query.name %></h2>
<%= @query.persisted? && @query.description.present? ? content_tag('p', @query.description, class: 'subtitle') : '' %>

<%= form_tag(admin_projects_path(@project, nil), :method => :get, :id => 'query_form') do %>
<%= hidden_field_tag 'admin_projects', '1' %>
<%= render :partial => 'queries/query_form' %>
<% end %>

<% if @query.valid? %>
  <%if @projects.any? %>
    <%= render :partial => 'projects/list', :locals => { :entries => @projects }%>
  <% else %>
    <p class="nodata"><%= l(:label_no_data) %></p>
  <% end %>
<% end %>

<% content_for :sidebar do %>
  <%= render :partial => 'projects/sidebar' %>
<% end %>
