Add the app version to the home index template context

This commit is contained in:
Paul van Tilburg 2018-01-02 12:48:58 +01:00
parent 0cf8335184
commit ee0d056d18
1 changed files with 5 additions and 1 deletions

View File

@ -5,6 +5,7 @@ use super::super::ListStore;
#[derive(Serialize)]
struct IndexTemplateContext<'a> {
app_version: &'a str,
lists: Vec<HashMap<&'a str, &'a str>>
}
@ -18,7 +19,10 @@ fn index(lists: State<ListStore>) -> Template {
list_kv.insert("name", list.name.as_ref());
list_kvs.push(list_kv);
}
let context = IndexTemplateContext { lists: list_kvs };
let context = IndexTemplateContext {
app_version: env!("CARGO_PKG_VERSION"),
lists: list_kvs
};
Template::render("index", &context)
}