add version number to botton of pages
This commit is contained in:
parent
70c7747ca9
commit
f109734a32
3 changed files with 17 additions and 1 deletions
|
@ -4,7 +4,7 @@ use crate::config::{read_config, Route, RouteGroup};
|
|||
use actix_web::{middleware::Logger, App, HttpServer};
|
||||
use clap::{crate_authors, crate_version, load_yaml, App as ClapApp};
|
||||
use error::BunBunError;
|
||||
use handlebars::Handlebars;
|
||||
use handlebars::{Output, Handlebars, HelperResult, RenderContext, Context, Helper};
|
||||
use hotwatch::{Event, Hotwatch};
|
||||
use log::{debug, info, trace, warn};
|
||||
use std::cmp::min;
|
||||
|
@ -117,6 +117,8 @@ fn cache_routes(groups: &[RouteGroup]) -> HashMap<String, Route> {
|
|||
/// templates at runtime.
|
||||
fn compile_templates() -> Handlebars {
|
||||
let mut handlebars = Handlebars::new();
|
||||
handlebars.set_strict_mode(true);
|
||||
handlebars.register_partial("bunbun_version", env!("CARGO_PKG_VERSION")).unwrap();
|
||||
macro_rules! register_template {
|
||||
[ $( $template:expr ),* ] => {
|
||||
$(
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
h1, p { margin: 0; }
|
||||
main { display: flex; }
|
||||
a { color: white; }
|
||||
footer {
|
||||
margin-top: 1rem;
|
||||
color: #444;
|
||||
}
|
||||
</style>
|
||||
<link rel="search"
|
||||
type="application/opensearchdescription+xml"
|
||||
|
@ -51,4 +55,7 @@
|
|||
</main>
|
||||
<p>To view a full list of commands, check out the <a href="/ls">command list</a>.</p>
|
||||
</body>
|
||||
<footer>
|
||||
<p>{{> bunbun_version}}</p>
|
||||
</footer>
|
||||
</html>
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
td, th { padding: 0 0.5rem; }
|
||||
.shortcut { text-align: right; }
|
||||
.target { text-align: left; width: 100%; }
|
||||
footer {
|
||||
margin-top: 1rem;
|
||||
color: #444;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -39,4 +43,7 @@
|
|||
{{/each}}
|
||||
</main>
|
||||
</body>
|
||||
<footer>
|
||||
<p>{{> bunbun_version}}</p>
|
||||
</footer>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue