<script type="text/javascript">
  <% unless @cities.empty? %>
    // Scroll down to search results
    $(document).ready(function() {
      $('html, body').animate({
        scrollTop: $("#cities").offset().top
      }, 2000);
    })
  <% end %>
</script>

<div class="full-window centerable">
  <div id="cities_search" class="centered">

    <div class="centered">
      <h3>Find your city</h3>
      <hr>

      <%= form_tag search_cities_path, method: :get, class: "" do %>

        <div class="form-group">
          <%= text_field_tag :query, nil, {
            class: 'form-control',
            placeholder: 'Enter your zip code or search for a city...',
            value: @query,
            tabindex: 1,
            autofocus: true
          } %>
        </div>

        <%= submit_tag 'Go', class: 'btn btn-default btn-primary' %>
      <% end %>
    </div>
  </div>
</div>

<ul id="cities" class="list-group">
  <% @cities.each do |city| %>
    <li class="list-group-item btn btn-default" onclick="window.location.href = '<%= city_path city %>'">
      <%= "#{city.name}, #{city.state}" %>
    </li>
  <% end %>
</ul>

<script type="text/javascript">
  <% unless @cities.empty? %>
    // Scroll down to search results
    $(document).ready(function() {
      $('html, body').animate({
        scrollTop: $("#cities").offset().top
      }, 2000);
    })
  <% end %>
</script>

<div class="full-window centerable">
  <div id="cities_search" class="centered">

    <div class="centered">
      <h3>Find your city</h3>
      <hr>

      <%= form_tag search_cities_path, method: :get, class: "" do %>

        <div class="form-group">
          <%= text_field_tag :query, nil, {
            class: 'form-control',
            placeholder: 'Enter your zip code or city...',
            value: @query,
            tabindex: 1,
            autofocus: true
          } %>
        </div>

        <%= submit_tag 'Go', class: 'btn btn-default btn-primary' %>
      <% end %>
    </div>
  </div>
</div>

<ul id="cities" class="list-group">
  <% @cities.each do |city| %>
    <% if city.zip_codes.length > 1 %>
      <li class="list-group-item btn btn-default" onclick="window.location.href = '<%= city_path city %>'">
        <%= "#{city.name}, #{city.state} #{city.zip_codes[0].name} - #{city.zip_codes[1].name}" %>
      </li>
    <% else %>
      <li class="list-group-item btn btn-default" onclick="window.location.href = '<%= city_path city %>'">
        <%= "#{city.name}, #{city.state} #{city.zip_codes[0].name}" %>
      </li>
    <% end %>
  <% end %>
</ul>

Print zipcode in search results
Print zipcode in search results
