From 9857f26bdd4e9e87b13a9755b1e00569e9459238 Mon Sep 17 00:00:00 2001 From: boasting-squirrel Date: Fri, 8 Mar 2019 19:59:59 +0100 Subject: Download folder as a tar working --- src/renderer.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/renderer.rs') diff --git a/src/renderer.rs b/src/renderer.rs index 89a9248..b83a67c 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 @@ -19,6 +20,9 @@ pub fn page( body { span #top { } h1 { (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, @@ -259,6 +275,25 @@ fn css() -> Markup { color: #3498db; text-decoration: none; } + .download { + display: flex; + justify-content: flex-end; + padding: 0.125rem; + } + .download a, .download a:visited { + color: #3498db; + } + .download a { + background: #efefef; + padding: 0.5rem; + border-radius: 0.2rem; + } + .download a:hover { + background: #deeef7a6; + } + .download a:not(:last-of-type) { + margin-right: 1rem; + } @media (max-width: 600px) { h1 { font-size: 1.375em; -- cgit v1.2.3 From 312a644244d0ce9e299183a4985adf356598785e Mon Sep 17 00:00:00 2001 From: boasting-squirrel Date: Fri, 15 Mar 2019 17:50:30 +0100 Subject: Improved design --- src/renderer.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/renderer.rs') diff --git a/src/renderer.rs b/src/renderer.rs index b83a67c..38a3802 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -19,7 +19,7 @@ pub fn page( (page_header(page_title)) body { span #top { } - h1 { (page_title) } + h1.title { (page_title) } div.download { (archive_button(archive::CompressionMethod::TarGz)) } @@ -182,6 +182,9 @@ fn css() -> Markup { margin: 0; padding: 0; } + h1 { + font-size: 1.5rem; + } table { margin-top: 2rem; width: 100%; @@ -277,8 +280,8 @@ fn css() -> Markup { } .download { display: flex; - justify-content: flex-end; - padding: 0.125rem; + flex-wrap: wrap; + margin-top: .5rem; } .download a, .download a:visited { color: #3498db; @@ -287,6 +290,7 @@ fn css() -> Markup { background: #efefef; padding: 0.5rem; border-radius: 0.2rem; + margin-top: 1rem; } .download a:hover { background: #deeef7a6; -- cgit v1.2.3 From cc80d54d5274ad54a916617d4f1d7686880192ab Mon Sep 17 00:00:00 2001 From: boasting-squirrel Date: Fri, 15 Mar 2019 17:55:17 +0100 Subject: Added missing padding on download div --- src/renderer.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/renderer.rs') diff --git a/src/renderer.rs b/src/renderer.rs index 38a3802..66fc714 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -282,6 +282,7 @@ fn css() -> Markup { display: flex; flex-wrap: wrap; margin-top: .5rem; + padding: 0.125rem; } .download a, .download a:visited { color: #3498db; -- cgit v1.2.3