refactor(templates): Move search result template to Askama
This commit is contained in:
parent
2bbcced032
commit
4747bacfe9
2 changed files with 4 additions and 3 deletions
|
@ -246,7 +246,8 @@ impl Handler<EditPostPage> for Renderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Message used to render search results
|
/// Message used to render search results
|
||||||
#[derive(Serialize)]
|
#[derive(Template)]
|
||||||
|
#[template(path = "search.html")]
|
||||||
pub struct SearchResultPage {
|
pub struct SearchResultPage {
|
||||||
pub query: String,
|
pub query: String,
|
||||||
pub results: Vec<SearchResult>,
|
pub results: Vec<SearchResult>,
|
||||||
|
@ -257,6 +258,6 @@ impl Handler<SearchResultPage> for Renderer {
|
||||||
type Result = Result<String>;
|
type Result = Result<String>;
|
||||||
|
|
||||||
fn handle(&mut self, msg: SearchResultPage, _: &mut Self::Context) -> Self::Result {
|
fn handle(&mut self, msg: SearchResultPage, _: &mut Self::Context) -> Self::Result {
|
||||||
Ok(self.tera.render("search.html", &msg)?)
|
msg.render().map_err(|e| e.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
<div class="mdl-card mdl-cell--6-col search-result mdl-shadow--2dp">
|
<div class="mdl-card mdl-cell--6-col search-result mdl-shadow--2dp">
|
||||||
<div class="mdl-card__supporting-text">
|
<div class="mdl-card__supporting-text">
|
||||||
<p>Posted in '{{ result.title }}' by {{ result.author }}:</p>
|
<p>Posted in '{{ result.title }}' by {{ result.author }}:</p>
|
||||||
<p>{{ result.headline | safe }}</p>
|
<p>{{ result.headline|safe }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-card__actions mdl-card--border post-actions">
|
<div class="mdl-card__actions mdl-card--border post-actions">
|
||||||
<div class="mdl-layout-spacer"></div>
|
<div class="mdl-layout-spacer"></div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue