diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2016-09-01 08:11:44 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2016-09-01 08:11:44 +0200 |
| commit | 5b054d1fb39604419150051dd1d99dacbdeb2cba (patch) | |
| tree | f11e9dc7e50b2d5210103d2b85f3ebcfaa5209a8 | |
| parent | 7aba8a17bae437bfba2cb6c6496f750d014f3636 (diff) | |
| download | phinde-5b054d1fb39604419150051dd1d99dacbdeb2cba.tar.gz phinde-5b054d1fb39604419150051dd1d99dacbdeb2cba.zip | |
Make search result hit template configurable, add chat template
Resolves: #9
| -rw-r--r-- | data/config.php.dist | 2 | ||||
| -rw-r--r-- | data/templates/search/hit-chat.htm | 22 | ||||
| -rw-r--r-- | data/templates/search/list.htm | 2 | ||||
| -rw-r--r-- | www/css/phinde.css | 12 | ||||
| -rw-r--r-- | www/index.php | 1 |
5 files changed, 37 insertions, 2 deletions
diff --git a/data/config.php.dist b/data/config.php.dist index 1e2641a..9170a9f 100644 --- a/data/config.php.dist +++ b/data/config.php.dist @@ -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 index 0000000..f44319d --- /dev/null +++ b/data/templates/search/hit-chat.htm @@ -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> diff --git a/data/templates/search/list.htm b/data/templates/search/list.htm index c034dc2..97c1731 100644 --- a/data/templates/search/list.htm +++ b/data/templates/search/list.htm @@ -21,7 +21,7 @@ </p> <ul class="hits"> {% for hit in hits %} - {% include 'search/hit.htm' %} + {% include hitTemplate %} {% endfor %} </ul> {% include 'pager.htm' %} diff --git a/www/css/phinde.css b/www/css/phinde.css index a25aa31..eae8dd9 100644 --- a/www/css/phinde.css +++ b/www/css/phinde.css @@ -31,4 +31,14 @@ .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; +} diff --git a/www/index.php b/www/index.php index 6bdaf9d..5261156 100644 --- a/www/index.php +++ b/www/index.php @@ -163,6 +163,7 @@ render( 'sort' => $sort, 'urlSortRelevance' => $urlSortRelevance, 'urlSortDate' => $urlSortDate, + 'hitTemplate' => 'search/' . $GLOBALS['phinde']['hitTemplate'], ) ); ?> |
