Connecting to LinkedIn...

search_results.liquid

This template displays the Jobs which match the search parameters and allows the candidate to save the Search for their Job Alert emails.

The variables specific to this template are results, pagination_html, search, search_already_saved, and geocoded_location.

The results variable is simply an array of the jobs matching the search with the pagination_html variable displaying the pagination links if the results span more than 1 page.

The search variable is the Search record which was created when the search was performed.

The search_already_saved variable is either 'true' or 'false' and can be used to make sure a candidate does not save the search more than once, for example:

  {% form 'save_search' %}
    {% if user %}
      {% if search_already_saved == 'true' %}
        {{ "Your Saved Searches" | account_link }}
      {% else %}
        {{ "Save this Search" | save_search_link }}
      {% endif %}
    {% else %}
      {{ 'Login to Save Searches' | login_link }}
    {% endif %}
  {% endform %}

The geocoded_location variable is an array of multiple possible locations Google has found based on the location query for the search. It can be used to display the location options so the candidate can select the most appropriate location. It can be used as follows:

{% if geocoded_location.size > 1 %}
  <h2>Multiple Locations Found</h2>
  <ul>
    {% for location in geocoded_location %}
      <li class="alt_location"><input id="{{ location.address }}" name="alt_locations" type="radio" {% if forloop.index == 1  %}checked="checked"{% endif %} value="{{ location.address }}"> {{ location.address }}</li>
    {% endfor %}
  </ul>
{% endif %}

... with some javascript triggering a new submit with the selected location:

$(document).ready(function() {
  $("input:radio[name=alt_locations]").click(function() {
    var val = $("input:radio[name=alt_locations]:checked").val();
    $('#location').val(val);
    $('input:radio[name=alt_locations]').attr("disabled", true);
    $('.alt_location').css("color", "#666");
    $("#search").submit();
  });
});