<div class="filters">
  <%= form_tag params, :method => :get do %>
    <p>
      <%= label_tag(:start_date, 'From Date: ') %>
      <%= date_field(:date, :start_date, :value => time_to_date_box(@start_date)) %>

      <%= label_tag(:end_date, 'To Date: ') %>
      <%= date_field(:date, :end_date, :value => time_to_date_box(@end_date)) %>

      <% developers = @builds.pluck(:developer).uniq %>
      <% if developers.count > 1 %>
        <%= label_tag(:developer, 'Developer: ') %>
        <!--Sort developers by name, downcased for consistency-->
        <%= select_tag :developer, options_for_select(@builds.pluck(:developer).uniq.sort_by { |d| d.downcase }),
                       :include_blank => true %>
      <% end %>

      <%= label_tag(:result, 'Result') %>
      <%= select_tag :result, options_for_select(@builds.pluck(:result).uniq), :include_blank => true %>

      <%= submit_tag 'Search' %>
    </p>
  <% end %>
</div>
