Make search result hit template configurable, add chat template
authorChristian Weiske <cweiske@cweiske.de>
Thu, 1 Sep 2016 06:11:44 +0000 (08:11 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 1 Sep 2016 06:11:44 +0000 (08:11 +0200)
Resolves: #9

data/config.php.dist
data/templates/search/hit-chat.htm [new file with mode: 0644]
data/templates/search/list.htm
www/css/phinde.css
www/index.php

index 1e2641a4c91ffb1f1f751f5fc653adce2c8a2fc0..9170a9f4969940c41a372d03b5e976764034dd4e 100644 (file)
@@ -28,5 +28,7 @@ $GLOBALS['phinde'] = array(
     //show the full text content in the results
     // useful for chat logs in which every line is its own document
     'showFullContent' => false,
+    //search result "hit" template file
+    'hitTemplate' => 'hit.htm',
 );
 ?>
\ No newline at end of file
diff --git a/data/templates/search/hit-chat.htm b/data/templates/search/hit-chat.htm
new file mode 100644 (file)
index 0000000..f44319d
--- /dev/null
@@ -0,0 +1,22 @@
+{% set doc = hit._source %}
+<li class="hit hit-chat">
+ <span class="text">
+  {{doc.htmlText|raw}}
+ </span>
+ <br/>
+ <span class="meta">
+  {% if doc.author.name %}
+  <em>
+   {% if doc.author.url %}
+   <a href="{{doc.author.url}}">{{doc.author.name}}</a>
+   {% else %}
+   {{doc.author.name}}
+   {% endif %}
+  </em>
+  at
+  {% endif %}
+  {% if doc.modate %}
+  <a href="{{doc.extra.cleanUrl}}" class="date">{{doc.modate|date("Y-m-d H:i")}}</a>
+  {% endif %}
+ </span>
+</li>
index c034dc2f0a8a6b66a3de3c42520f689fcfe02c51..97c173133fde8c233620126e21dbee4a59541c95 100644 (file)
@@ -21,7 +21,7 @@
  </p>
  <ul class="hits">
  {% for hit in hits %}
-   {% include 'search/hit.htm' %}
+   {% include hitTemplate %}
  {% endfor %}
  </ul>
  {% include 'pager.htm' %}
index a25aa31c5eab83704d9da76d8011542e37b46fad..eae8dd91a017c9a78cd8d898842237734a79b429 100644 (file)
 .resultinfo {
     margin-top: 1ex;
     margin-bottom: 2ex;
-}
\ No newline at end of file
+}
+
+.hit-chat .meta {
+    margin-left: 3ex;
+}
+.hit-chat .date {
+    color: inherit;
+}
+.hit-chat .meta {
+    opacity: 0.5;
+}
index 6bdaf9d2d4ff2a79974cc9f9427b2bcef0c63449..5261156642603da19f41a1fa385b0b8c72d0cdbf 100644 (file)
@@ -163,6 +163,7 @@ render(
         'sort' => $sort,
         'urlSortRelevance' => $urlSortRelevance,
         'urlSortDate' => $urlSortDate,
+        'hitTemplate' => 'search/' . $GLOBALS['phinde']['hitTemplate'],
     )
 );
 ?>