Skip to content
Snippets Groups Projects
Unverified Commit 45bcf9dc authored by Chris Lawton's avatar Chris Lawton Committed by GitHub
Browse files

Merge pull request #103 from OpenTechFund/feature/162-search-results

Feature/162 search results
parents cc8a6af4 db70bcf5
No related branches found
No related tags found
No related merge requests found
{% load static wagtailcore_tags wagtailsearchpromotions_tags wagtailimages_tags %} {% load static wagtailcore_tags wagtailsearchpromotions_tags wagtailimages_tags %}
{# breadcrumbs #} <a class="listing" href="{% pageurl result %}">
{% if result.get_ancestors|length > 2 %} {# breadcrumbs #}
{% for ancestor in result.get_ancestors %} {% if result.get_ancestors|length > 2 %}
{% if not ancestor.is_root %} <h6 class="listing__path">
{% if ancestor.depth > 2 %} {% for ancestor in result.get_ancestors %}
{{ ancestor.title }} {% if not ancestor.is_root %}
{% if ancestor.depth|add:1 < result.depth %} {% if ancestor.depth > 2 %}
&nbsp;/&nbsp; <span>{{ ancestor.title }}</span>
{% if ancestor.depth|add:1 < result.depth %}
<span class="nav__item--breadcrumb"></span>
{% endif %}
{% else %}<span class="nav__item--breadcrumb"></span>{% endif %} {# the first one #}
{% endif %} {% endif %}
{% else %}/{% endif %} {# the first one #} {% endfor %}
{% endif %} </h6>
{% endfor %} {% endif %}
{% endif %}
{% if result.listing_image %} {% if result.listing_image or result.icon %}
<a href="{% pageurl result %}"> {% image result.listing_image|default:result.icon fill-180x180 class="listing__image" %}
{% image result.listing_image fill-450x300 %} {% else %}
</a> <div class="listing__image listing__image--default">
{% endif %} <svg><use xlink:href="#logo-mobile-no-text"></use></svg>
</div>
<h4> {% endif %}
<a href="{% pageurl result %}">
{{ result.listing_title|default:result.title }}
</a>
</h4>
{% if pick.description or result.listing_summary or result.search_description %}
<p>{{ pick.description|default:result.listing_summary|default:result.search_description }}</p>
{% endif %}
<h4 class="listing__title">{{ result.listing_title|default:result.title }}</h4>
{% if pick.description or result.listing_summary or result.search_description or result.listing_summary or result.introduction %}
<h6 class="listing__teaser">{{ pick.description|default:result.listing_summary|default:result.search_description|default:result.listing_summary|default:result.introduction|truncatechars_html:155 }}</h6>
{% endif %}
</a>
{% extends "base.html" %} {% extends "base.html" %}
{% load static wagtailcore_tags wagtailsearchpromotions_tags %} {% load static wagtailcore_tags wagtailsearchpromotions_tags %}
{% block body_class %}template-searchresults light-grey-bg{% endblock %}
{% block body_class %}template-searchresults{% endblock %} {% block page_title %}Search results{% endblock %}
{% block title %}{% if search_query %}Search results for &ldquo;{{ search_query }}&rdquo;{% else %}Search{% endif %}{% endblock %} {% block title %}{% if search_query %}Search results for &ldquo;{{ search_query }}&rdquo;{% else %}Search{% endif %}{% endblock %}
{% block content %} {% block content %}
<div class="wrapper wrapper--small wrapper--top-bottom-inner-space">
<h1>{% if search_query %}Search results for &ldquo;{{ search_query }}&rdquo;{% else %}Search{% endif %}</h1> <h2 class="heading heading--no-margin">{% if search_query %}Search results for &ldquo;{{ search_query }}&rdquo;{% else %}Search{% endif %}</h2>
<form action="{% url 'search' %}" method="get" role="search"> {% if search_results %}
<input type="text" placeholder="Search…" name="query"{% if search_query %} value="{{ search_query }}"{% endif %}> {% with count=search_results.paginator.count %}
<input type="submit" value="Search"> <p>{{ count }} result{{ count|pluralize }} found.</p>
</form> {% endwith %}
{% elif search_query and not search_picks %}
{% get_search_promotions search_query as search_picks %} <p>No results found.</p>
{% if search_picks %} {% endif %}
<ul>
{% for pick in search_picks %} <form class="form" action="{% url 'search' %}" method="get" role="search" aria-label="Search form">
<li> <input class="input input--bottom-space" type="text" placeholder="Search…" name="query"{% if search_query %} value="{{ search_query }}"{% endif %} aria-label="Search input">
<input class="link link--button" type="submit" value="Search" aria-label="search">
</form>
{% get_search_promotions search_query as search_picks %}
{% if search_picks %}
<div class="wrapper wrapper--listings">
{% for pick in search_picks %}
{% include "search/includes/search_result.html" with result=pick.page.specific %} {% include "search/includes/search_result.html" with result=pick.page.specific %}
</li> {% endfor %}
{% endfor %} </div>
</ul> {% endif %}
{% endif %}
{% if search_results %} {% if search_results %}
<div class="wrapper wrapper--listings">
{% with count=search_results.paginator.count %} {% for result in search_results %}
{{ count }} result{{ count|pluralize }} found.
{% endwith %}
<ul>
{% for result in search_results %}
<li>
{% include "search/includes/search_result.html" with result=result.specific %} {% include "search/includes/search_result.html" with result=result.specific %}
</li> {% endfor %}
{% endfor %} </div>
</ul> {% include "includes/pagination.html" with paginator_page=search_results %}
{% endif %}
{% include "includes/pagination.html" with paginator_page=search_results %} </div>
{% elif search_query and not search_picks %}
No results found.
{% endif %}
{% endblock %} {% endblock %}
...@@ -69,7 +69,7 @@ ol { ...@@ -69,7 +69,7 @@ ol {
.is-visible, .is-visible,
%is-visible { %is-visible {
z-index: 5; z-index: 9;
opacity: 1; opacity: 1;
transition: opacity, z-index, $transition; transition: opacity, z-index, $transition;
} }
......
...@@ -4,4 +4,8 @@ ...@@ -4,4 +4,8 @@
background: transparent; background: transparent;
border: 0; border: 0;
} }
&--bottom-space {
margin-bottom: 10px
}
} }
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
} }
} }
&__path,
&__category { &__category {
margin-bottom: 5px; margin-bottom: 5px;
color: $color--default; color: $color--default;
...@@ -77,4 +78,8 @@ ...@@ -77,4 +78,8 @@
margin-left: 5px; margin-left: 5px;
} }
} }
&__path {
display: flex;
}
} }
...@@ -112,6 +112,10 @@ ...@@ -112,6 +112,10 @@
font-weight: $weight--normal; font-weight: $weight--normal;
border-bottom: 0; border-bottom: 0;
.listing & {
margin-left: 10px;
}
&::after { &::after {
width: 0; width: 0;
height: 0; height: 0;
...@@ -120,9 +124,18 @@ ...@@ -120,9 +124,18 @@
border-bottom: 5px solid transparent; border-bottom: 5px solid transparent;
border-left: 5px solid $color--white; border-left: 5px solid $color--white;
content: ''; content: '';
.listing & {
margin-left: 0;
border-left: 5px solid $color--default;
}
} }
&:first-child { &:first-child {
.listing & {
margin-left: 0;
}
a { a {
margin-left: 0; margin-left: 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment