Commit 64899aa6 authored by mrodzis's avatar mrodzis 🌎 Committed by Mathias Goebel
Browse files

Add first draft for visible search term (closes #13)

parent 161ccfa4
......@@ -9,6 +9,11 @@ declare namespace cf="https://sade.textgrid.de/ns/configfile";
declare namespace tei="http://www.tei-c.org/ns/1.0";
declare namespace templates="http://exist-db.org/xquery/templates";
declare function fsearch:return-query($node as node(), $model as map(*), $q as xs:string?)
as xs:string? {
$q
};
declare function fsearch:results($node as node(), $model as map(*)) as map()* {
let $page := xs:integer(request:get-parameter("page", "1"))
let $target := $config:app-root || "/" || config:get("project-id") || "/data"
......
......@@ -28,7 +28,7 @@ declare function local:multiLangSwitcher($langconfig, $lang) as node(){
}
};
declare function lang:translate( $node as node(), $model as map(*), $content as xs:string ) as node() {
declare function lang:translate( $node as node(), $model as map(*), $content as xs:string, $q as xs:string? ) as node() {
let $langconfig := doc( $config:app-root || "/lang.xml" )
return
......@@ -39,11 +39,22 @@ return
case element (input) return element input {
(: Language stuff for search in results.html :)
if ($content = "SearchResults") then (
attribute id {"searchLang"},
attribute type {"hidden"},
attribute name {"lang"},
attribute value {$lang:lang}
)
attribute id {"searchLang"},
attribute type {"hidden"},
attribute name {"lang"},
attribute value {if($q) then $q else $lang:lang}
)
(: set the search term to the input field :)
else if ($content="Search") then (
if($q) then attribute value {$q}
else $node/@value,
for $att in $node/@*[not(local-name() = "value")]
let $att-name := name($att)
return if ($att-name != "placeholder") then attribute {$att-name} {$att}
else ()
)
(: Placeholder stuff for input items :)
else (
attribute placeholder {$langconfig//lf:word[@key=$content]/lf:lang[@key=$lang:lang]},
......
......@@ -18,10 +18,10 @@
<ul xmlns="http://www.w3.org/1999/xhtml">
<li class="feat">Features
<ul>
<li>Updated third party software (e.g. Bootstrap, jQuery, TEI stylesheets, ...)</li>
<li>Updated third party software (e.g. Bootstrap, jQuery, TEI stylesheets, )</li>
<li>Added an environment for easy local testing</li>
<li>Added a server sided mechanism for displaying TEI encoding</li>
<li>Added the possibility to generate call graphs for developing, docs, ...</li>
<li>Added the possibility to generate call graphs for developing, docs, </li>
<li>Increased the overall frontend usability</li>
<li>Ensured compatibility to Windows</li>
<li>Updated the technical info page</li>
......
......@@ -7,6 +7,23 @@
<div>
<span id="page" class="hidden" data-template="fsearch:page"/>
<span id="pages" class="hidden" data-template="fsearch:pages"/>
<div>
<div>Sie haben nach <strong>
<span id="prevQuery"><span data-template="fsearch:return-query"/></span>
</strong> gesucht.</div>
<div class="search-input">
<form class="form-inline">
<div class="form-group mx-sm-3 mb-2" action="search.html">
<label for="inputTerm" class="sr-only">Neue Suche</label>
<input type="text" class="form-control" id="inputTerm" placeholder="Neue Suche" data-template="lang:translate" data-template-content="Search" name="q" />
</div>
<button type="submit" class="btn btn-primary mb-2">
<i class="fas fa-search fa-lg" style="color:white"/>
</button>
</form>
</div>
</div>
<div>
<ul class="paginator pull-right"/>
Zeige Treffer <span id="hitstart" data-template="fsearch:hitstart"/> -
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment