Reword about page. Add list of dependencies and licenses

This commit is contained in:
Magnus Hoff 2017-11-07 15:50:00 +01:00
parent 7ad2a2ad73
commit 26fc263cd4
2 changed files with 79 additions and 8 deletions

View file

@ -15,11 +15,61 @@ impl AboutResource {
} }
} }
enum License {
Bsd3Clause,
Gpl3,
Mit,
Mpl2,
Ofl11,
}
impl License {
fn link(&self) -> &'static str {
use self::License::*;
match self {
&Bsd3Clause => "bsd-3-clause",
&Gpl3 => "gpl3",
&Mit => "mit",
&Mpl2 => "mpl2",
&Ofl11 => "sil-ofl-1.1",
}
}
fn name(&self) -> &'static str {
use self::License::*;
match self {
&Bsd3Clause => "BSD-3-Clause",
&Gpl3 => "GPL3",
&Mit => "MIT",
&Mpl2 => "MPL2",
&Ofl11 => "OFL-1.1",
}
}
}
struct Dependency {
name: &'static str,
copyright: &'static str,
license: License,
}
lazy_static! {
static ref DEPS: &'static [Dependency] = &[
Dependency {
name: "Amatic SC",
copyright: "Copyright 2015 The Amatic SC Project Authors (contact@sansoxygen.com)",
license: License::Ofl11,
},
];
}
#[derive(BartDisplay)] #[derive(BartDisplay)]
#[template="templates/about.html"] #[template="templates/about.html"]
struct Template; struct Template<'a> {
deps: &'a [Dependency]
}
impl Template { impl<'a> Template<'a> {
fn pkg_version(&self) -> &str { env!("CARGO_PKG_VERSION") } fn pkg_version(&self) -> &str { env!("CARGO_PKG_VERSION") }
} }
@ -45,7 +95,9 @@ impl Resource for AboutResource {
.with_body(Layout { .with_body(Layout {
base: None, // Hmm, should perhaps accept `base` as argument base: None, // Hmm, should perhaps accept `base` as argument
title: "About Sausagewiki", title: "About Sausagewiki",
body: &Template, body: &Template {
deps: &*DEPS
},
}.to_string())) }.to_string()))
})) }))
} }

View file

@ -4,9 +4,9 @@
</header> </header>
<article> <article>
<p>This site is running version {{pkg_version()}} of Sausagewiki.</p> <p>This site is running version {{pkg_version()}} of Sausagewiki, a simple,
<p>Sausagewiki is a simple, self-contained wiki engine.</p> self-contained wiki engine.</p>
<p>Copyright &copy; 2017 Magnus Hovland Hoff</p> <p>Copyright &copy; 2017 Magnus Hovland Hoff.</p>
<p> <p>
This program is free software: you can redistribute it and/or modify it under This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -14,11 +14,30 @@ Foundation, either version 3 of the License, or (at your option) any later
version. version.
</p> </p>
<p>See also <a href="_about/gpl3">the full license text</a>.</p> <p>
See also <a href="_about/gpl3">the full license text</a> and the
<a href="https://github.com/maghoff/sausagewiki">project home page</a>.
</p>
<p> <p>
<a href="https://github.com/maghoff/sausagewiki">Project home page</a> A huge thanks to <a href="https://www.rust-lang.org/en-US/">Rust</a> and
<a href="https://www.sqlite.org/">SQLite</a>. Without these amazing projects,
Sausagewiki would never have materialized.
</p> </p>
<p>
Sausagewiki builds on a number of projects, copyright by their respective
copyright holders and distributed under various licenses:
</p>
<table>
<thead><tr><th>Project</th><th>Copyright notice</th><th>License</th></tr></thead>
<tbody>
{{#deps}}
<tr><td>{{.name}}</td><td>{{.copyright}}</td><td><a href="_about/{{.license.link()}}">{{.license.name()}}</a></td></tr>
{{/deps}}
</tbody>
</table>
</article> </article>
</div> </div>