Skip to content

Commit

Permalink
Merge pull request #202 from ZeusWPI/feature/show-version
Browse files Browse the repository at this point in the history
Show Zauth version in footer
  • Loading branch information
rien authored Jun 10, 2022
2 parents f89e87a + 3d9adf4 commit 4a37726
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ use std::str::FromStr;
pub struct DbConn(PgConnection);
pub type ConcreteConnection = PgConnection;

pub const ZAUTH_VERSION: &str = env!("CARGO_PKG_VERSION");

#[get("/favicon.ico")]
pub fn favicon() -> &'static str {
""
Expand Down
12 changes: 10 additions & 2 deletions src/views/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ macro_rules! template {
use askama::Template;
#[derive(Template, Debug)]
#[template(path = $template_name)]
struct TemplateStruct {}
TemplateStruct{}
struct TemplateStruct {
#[allow(dead_code)]
zauth_version: &'static str
}
TemplateStruct {
zauth_version: crate::ZAUTH_VERSION,
}
}
};

Expand All @@ -16,11 +21,14 @@ macro_rules! template {
#[derive(Template, Debug)]
#[template(path = $template_name)]
struct TemplateStruct {
#[allow(dead_code)]
zauth_version: &'static str,
$(
$name: $type,
)+
}
TemplateStruct {
zauth_version: crate::ZAUTH_VERSION,
$(
$name: $value,
)+
Expand Down
2 changes: 1 addition & 1 deletion templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<div class="columns is-multiline is-justify-content-space-between">
<!-- Copyright -->
<div class="column is-narrow">
<a href="/">Zauth</a> by <a href="https://zeus.gent" target="_blank">Zeus WPI</a>
<a href="https://github.com/ZeusWPI/zauth/releases/tag/v{{ zauth_version }}">Zauth v{{ zauth_version }}</a> by <a href="https://zeus.gent" target="_blank">Zeus WPI</a>
</div>

<!-- Change theme -->
Expand Down

0 comments on commit 4a37726

Please sign in to comment.