Create a new page based on search
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2020-05-24 00:59:04 +02:00
parent 38764b278a
commit f96bf8e8f8
2 changed files with 3 additions and 1 deletions

View File

@ -111,8 +111,9 @@ search(searchInput).then(searcher => {
} }
$('#autocomplete').show() $('#autocomplete').show()
let result = searcher.search(query) let result = searcher.search(query)
const newpage = query.replace(' ', '_')
var template = document.getElementById('result-template').innerHTML; var template = document.getElementById('result-template').innerHTML;
var rendered = Mustache.render(template, {results: result}, {}, ['[[', ']]']); var rendered = Mustache.render(template, {page: newpage, results: result}, {}, ['[[', ']]']);
let autocomplete = document.getElementById('autocomplete'); let autocomplete = document.getElementById('autocomplete');
autocomplete.innerHTML = rendered; autocomplete.innerHTML = rendered;
}, 500) }, 500)

View File

@ -259,6 +259,7 @@
[[#results]] [[#results]]
<li><a href="/[[ref]]">[[title]]</a></li> <li><a href="/[[ref]]">[[title]]</a></li>
[[/results]] [[/results]]
<ll><a href="/edit/[[page]]">Create a page</a></ll>
</ul> </ul>
</div> </div>
</body> </body>