diff options
Diffstat (limited to 'src/renderer.rs')
-rw-r--r-- | src/renderer.rs | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/src/renderer.rs b/src/renderer.rs index 89a9248..66fc714 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -3,6 +3,7 @@ use chrono_humanize::{Accuracy, HumanTime, Tense}; use maud::{html, Markup, PreEscaped, DOCTYPE}; use std::time::SystemTime; +use crate::archive; use crate::listing; /// Renders the file listing @@ -18,7 +19,10 @@ pub fn page( (page_header(page_title)) body { span #top { } - h1 { (page_title) } + h1.title { (page_title) } + div.download { + (archive_button(archive::CompressionMethod::TarGz)) + } table { thead { th { (build_link("name", "Name", &sort_method, &sort_order)) } @@ -50,6 +54,18 @@ pub fn page( } } +/// Partial: archive button +fn archive_button(compress_method: archive::CompressionMethod) -> Markup { + let link = format!("?download={}", compress_method.to_string()); + let text = format!("Download .{}", compress_method.extension()); + + html! { + a href=(link) { + (text) + } + } +} + /// Partial: table header link fn build_link( name: &str, @@ -166,6 +182,9 @@ fn css() -> Markup { margin: 0; padding: 0; } + h1 { + font-size: 1.5rem; + } table { margin-top: 2rem; width: 100%; @@ -259,6 +278,27 @@ fn css() -> Markup { color: #3498db; text-decoration: none; } + .download { + display: flex; + flex-wrap: wrap; + margin-top: .5rem; + padding: 0.125rem; + } + .download a, .download a:visited { + color: #3498db; + } + .download a { + background: #efefef; + padding: 0.5rem; + border-radius: 0.2rem; + margin-top: 1rem; + } + .download a:hover { + background: #deeef7a6; + } + .download a:not(:last-of-type) { + margin-right: 1rem; + } @media (max-width: 600px) { h1 { font-size: 1.375em; |