HandlerSearch: Render a form when no q= given
This commit is contained in:
vanhempi
75268e0073
commit
fdcef18861
@ -25,7 +25,10 @@ Response HandlerSearch::handleRequest(const Request &r)
|
||||
std::string q = r.get("q");
|
||||
if(q.empty())
|
||||
{
|
||||
return errorResponse("Missing search term", "No search term supplied");
|
||||
TemplatePage searchForm = this->templ->getPage("searchform");
|
||||
response.setBody(searchForm.render());
|
||||
response.setStatus(200);
|
||||
return response;
|
||||
}
|
||||
|
||||
auto pageDao = this->database->createPageDao();
|
||||
|
8
template/quitesimple/searchform
Normal file
8
template/quitesimple/searchform
Normal file
@ -0,0 +1,8 @@
|
||||
{qswiki:include:general_header}
|
||||
<main id="content">
|
||||
<h2>Search</h2>
|
||||
|
||||
Search content of pages:
|
||||
<form action="{qswiki:config:wikipath}" method="GET"><input type="hidden" name="action" value="search"/><input type="text" name="q" value="search here" onfocus="this.value=''"></form>
|
||||
</main>
|
||||
{qswiki:include:general_footer}
|
Ladataan…
Viittaa uudesa ongelmassa
Block a user