aboutsummaryrefslogtreecommitdiff
path: root/data/templates
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2016-02-03 17:23:06 +0100
committerChristian Weiske <cweiske@cweiske.de>2016-02-03 17:23:06 +0100
commite5c7780adb59e8038a040a1e534a4cee1fac8cd8 (patch)
tree2f8be5ac975398a7cb1084dd13c9350514119d85 /data/templates
parent226508cd8d3e8c147ad314a0de483e08be71c254 (diff)
downloadphinde-e5c7780adb59e8038a040a1e534a4cee1fac8cd8.tar.gz
phinde-e5c7780adb59e8038a040a1e534a4cee1fac8cd8.zip
filtering works
Diffstat (limited to 'data/templates')
-rw-r--r--data/templates/search/hit.htm28
-rw-r--r--data/templates/search/sidebar-filter.htm21
-rw-r--r--data/templates/search/sidebar.htm49
3 files changed, 45 insertions, 53 deletions
diff --git a/data/templates/search/hit.htm b/data/templates/search/hit.htm
index 3d8f633..4981017 100644
--- a/data/templates/search/hit.htm
+++ b/data/templates/search/hit.htm
@@ -1,11 +1,23 @@
{% set doc = hit._source %}
<li class="hit">
- <a href="{{doc.url}}">{{doc.title}}</a>
- {% if doc.author.name %}
- by <a href="{{doc.author.url}}">{{doc.author.name}}</a>
- {% endif %}
- <br/><tt>{{doc.extra.cleanUrl}}</tt>
- {% if doc.modate %}
- <br/>Changed: {{doc.extra.day}}
- {% endif %}
+ <span class="title">
+ <a href="{{doc.url}}">{{doc.title}}</a>
+ {% if doc.author.name %}
+ by
+ <em>
+ {% if doc.author.url %}
+ <a href="{{doc.author.url}}">{{doc.author.name}}</a>
+ {% else %}
+ {{doc.author.name}}
+ {% endif %}
+ </em>
+ {% endif %}
+ </span>
+ <br/><tt class="url" title="{{doc.extra.cleanUrl}}">{{ellipsis(doc.extra.cleanUrl, 60)}}</tt>
+ <span class="extract">
+ <br/>
+ {% if doc.modate %}
+ <span class="date">{{doc.extra.day|date("Y-m-d")}}</span>
+ {% endif %}
+ </span>
</li>
diff --git a/data/templates/search/sidebar-filter.htm b/data/templates/search/sidebar-filter.htm
new file mode 100644
index 0000000..6c4bc81
--- /dev/null
+++ b/data/templates/search/sidebar-filter.htm
@@ -0,0 +1,21 @@
+{% if attribute(activeFilters, type) %}
+ <b>{{title}}</b>
+ <ul class="nav nav-pills">
+ <li class="active">
+ <a href="{{attribute(activeFilters, type).removeUrl}}">
+ {{activeFilters[type].label|default('unknown')}} ❌
+ </a>
+ </li>
+ </ul>
+{% elseif attribute(aggregations, type).buckets|length > 1 %}
+<b>{{title}}</b>
+<ul class="nav nav-pills">
+{% for bucket in attribute(aggregations, type).buckets|slice(0, 10) %}
+ <li>
+ <a href="{{bucket.url}}">
+ {{bucket.key|default('unknown')}} ({{bucket.doc_count}})
+ </a>
+ </li>
+{% endfor %}
+</ul>
+{% endif %}
diff --git a/data/templates/search/sidebar.htm b/data/templates/search/sidebar.htm
index 619301e..eaddaeb 100644
--- a/data/templates/search/sidebar.htm
+++ b/data/templates/search/sidebar.htm
@@ -1,48 +1,7 @@
<p>
Filter results by:
</p>
-{% if aggregations.tags.buckets|length > 1 %}
-<b>Tag</b>
-<ul class="nav nav-pills">
-{% for bucket in aggregations.tags.buckets|slice(0, 10) %}
- <li>
- <a href="{{bucket.url}}">{{bucket.key}} ({{bucket.doc_count}})</a>
- </li>
-{% endfor %}
-</ul>
-{% endif %}
-
-{% if aggregations.domain.buckets|length > 1 %}
-<!-- FIXME: negate domain -->
-<b>Domain</b>
-<ul class="nav nav-pills">
-{% for bucket in aggregations.domain.buckets|slice(0, 10) %}
- <li>
- <a href="{{bucket.url}}">{{bucket.key}} ({{bucket.doc_count}})</a>
- </li>
-{% endfor %}
-</ul>
-{% endif %}
-
-{% if aggregations.language.buckets|length > 1 %}
-<b>Language</b>
-<ul class="nav nav-pills">
-{% for bucket in aggregations.language.buckets|slice(0, 10) %}
- <li>
- <a href="{{bucket.url}}">{{bucket.key}} ({{bucket.doc_count}})</a>
- </li>
-{% endfor %}
-</ul>
-{% endif %}
-
-{% if aggregations.type.buckets|length > 1 %}
-<b>Type</b>
-<ul class="nav nav-pills">
-{% for bucket in aggregations.type.buckets|slice(0, 10) %}
- <li>
- <a href="{{bucket.url}}">{{bucket.key}} ({{bucket.doc_count}})</a>
- </li>
-{% endfor %}
-</ul>
-{% endif %}
-
+{% include 'search/sidebar-filter.htm' with {'type': 'tags', 'title': 'Tag'} %}
+{% include 'search/sidebar-filter.htm' with {'type': 'domain', 'title': 'Domain'} %}
+{% include 'search/sidebar-filter.htm' with {'type': 'language', 'title': 'Language'} %}
+{% include 'search/sidebar-filter.htm' with {'type': 'type', 'title': 'Type'} %}