add version number to botton of pages

This commit is contained in:
Edward Shen 2020-04-14 20:34:04 -04:00
parent 70c7747ca9
commit f109734a32
Signed by: edward
GPG key ID: 19182661E818369F
3 changed files with 17 additions and 1 deletions

View file

@ -4,7 +4,7 @@ use crate::config::{read_config, Route, RouteGroup};
use actix_web::{middleware::Logger, App, HttpServer}; use actix_web::{middleware::Logger, App, HttpServer};
use clap::{crate_authors, crate_version, load_yaml, App as ClapApp}; use clap::{crate_authors, crate_version, load_yaml, App as ClapApp};
use error::BunBunError; use error::BunBunError;
use handlebars::Handlebars; use handlebars::{Output, Handlebars, HelperResult, RenderContext, Context, Helper};
use hotwatch::{Event, Hotwatch}; use hotwatch::{Event, Hotwatch};
use log::{debug, info, trace, warn}; use log::{debug, info, trace, warn};
use std::cmp::min; use std::cmp::min;
@ -117,6 +117,8 @@ fn cache_routes(groups: &[RouteGroup]) -> HashMap<String, Route> {
/// templates at runtime. /// templates at runtime.
fn compile_templates() -> Handlebars { fn compile_templates() -> Handlebars {
let mut handlebars = Handlebars::new(); let mut handlebars = Handlebars::new();
handlebars.set_strict_mode(true);
handlebars.register_partial("bunbun_version", env!("CARGO_PKG_VERSION")).unwrap();
macro_rules! register_template { macro_rules! register_template {
[ $( $template:expr ),* ] => { [ $( $template:expr ),* ] => {
$( $(

View file

@ -16,6 +16,10 @@
h1, p { margin: 0; } h1, p { margin: 0; }
main { display: flex; } main { display: flex; }
a { color: white; } a { color: white; }
footer {
margin-top: 1rem;
color: #444;
}
</style> </style>
<link rel="search" <link rel="search"
type="application/opensearchdescription+xml" type="application/opensearchdescription+xml"
@ -51,4 +55,7 @@
</main> </main>
<p>To view a full list of commands, check out the <a href="/ls">command list</a>.</p> <p>To view a full list of commands, check out the <a href="/ls">command list</a>.</p>
</body> </body>
<footer>
<p>{{> bunbun_version}}</p>
</footer>
</html> </html>

View file

@ -21,6 +21,10 @@
td, th { padding: 0 0.5rem; } td, th { padding: 0 0.5rem; }
.shortcut { text-align: right; } .shortcut { text-align: right; }
.target { text-align: left; width: 100%; } .target { text-align: left; width: 100%; }
footer {
margin-top: 1rem;
color: #444;
}
</style> </style>
</head> </head>
<body> <body>
@ -39,4 +43,7 @@
{{/each}} {{/each}}
</main> </main>
</body> </body>
<footer>
<p>{{> bunbun_version}}</p>
</footer>
</html> </html>