<%
var extra_class = '';
if( !("image_src" in item) && !("glyphicon" in item) )
extra_class += "suggestion-item--text-only"
%>
<li class="nav-item js-suggestion-item <%=extra_class%>" tabindex="-1" data-suggestion-href="<%=item.href%>">
  <% if(item.obj_type in templates){ %>
    <%= templates[item.obj_type]({item: item}) %>
    <%
  }else
  {
    %>
    <a class="nav-link" href="<%= item.href %>">
      <div class="media">
        <div class="media-left">
          <%
          var is_bg = false;
          if("image_src" in item && item.image_src !== '') { %>
            <img class="suggestion-item-image rounded-corners mr-2" src="<%= item.image_src %>">
            <%
          }else if("glyphicon" in item) {
            var style = "";
            if ("glyphicon_background" in item) {
              is_bg = true;
              style += 'background-color: ' + item.glyphicon_background + ';';
            }
            if ("glyphicon_colour" in item)
            style += 'color: ' + item.glyphicon_colour + ';';
            %>
            <span class="<%= item.glyphicon %> <%=is_bg?'suggestion-item__icon--bg':'' %> suggestion-item__icon mr-2" style="<%= style %>">
            </span>
            <% } %>
          </div>
          <div class="media-body">
            <p class="mb-0">
              <%
              var title;
              if ("title" in item.highlight)
              title = item.highlight.title;
              else
              title = _.escape(item.title);
              %>
              <%= title %>
            </p>
            <% if ("contents" in item.highlight) { %>
              <small class="text-muted d-block">
                <%= item.highlight.contents %>
              </small>
              <%}%>
            </div>
          </div>
        </a>
        <% } %>
      </li>
