Fixed upload bug + refactored @ else in templates
@@ -21,13 +21,15 @@ pub fn page(
current_dir: &str,
) -> Markup {
html! {
- (page_header(page_title, &color_scheme))
+ (page_header(page_title, &color_scheme, file_upload))
body#drop-container {
+ @if file_upload {
div.drag-form {
div.drag-title {
h1 { "Drop your file here to upload it" }
}
}
+ }
(color_scheme_selector(&sort_method, &sort_order, &color_scheme))
div.container {
span#top { }
@@ -652,7 +654,7 @@ fn chevron_down() -> Markup {
}
/// Partial: page header
-fn page_header(page_title: &str, color_scheme: &themes::ColorScheme) -> Markup {
+fn page_header(page_title: &str, color_scheme: &themes::ColorScheme, file_upload: bool) -> Markup {
html! {
(DOCTYPE)
html {
@@ -661,6 +663,7 @@ fn page_header(page_title: &str, color_scheme: &themes::ColorScheme) -> Markup {
meta name="viewport" content="width=device-width, initial-scale=1";
title { (page_title) }
style { (css(&color_scheme)) }
+ @if file_upload {
(PreEscaped(r#"
<script>
window.onload = function() {
@@ -701,6 +704,7 @@ fn page_header(page_title: &str, color_scheme: &themes::ColorScheme) -> Markup {
}
}
}
+}
/// Converts a SystemTime object to a strings tuple (date, time)
/// Date is formatted as %e %b, e.g. Jul 12
