aboutsummaryrefslogtreecommitdiffstats
path: root/src/renderer.rs
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2020-08-24 20:24:14 +0000
committerGitHub <noreply@github.com>2020-08-24 20:24:14 +0000
commit5a8b7677076cb89d3fc7d57a89a51245e3dc66eb (patch)
treecc5c186014c24c8dd0697a7b759c79acd66d6593 /src/renderer.rs
parentBump some deps (diff)
parentmake linter happy (diff)
downloadminiserve-5a8b7677076cb89d3fc7d57a89a51245e3dc66eb.tar.gz
miniserve-5a8b7677076cb89d3fc7d57a89a51245e3dc66eb.zip
Merge pull request #362 from ahti/master
visual and sorting fixes
Diffstat (limited to 'src/renderer.rs')
-rw-r--r--src/renderer.rs32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/renderer.rs b/src/renderer.rs
index 7270e8f..17e0119 100644
--- a/src/renderer.rs
+++ b/src/renderer.rs
@@ -22,13 +22,14 @@ pub fn page(
show_qrcode: bool,
file_upload: bool,
upload_route: &str,
- current_dir: &str,
+ encoded_dir: &str,
+ display_dir: &str,
tar_enabled: bool,
zip_enabled: bool,
) -> Markup {
let upload_action = build_upload_action(
upload_route,
- current_dir,
+ encoded_dir,
sort_method,
sort_order,
color_scheme,
@@ -38,7 +39,7 @@ pub fn page(
html! {
(DOCTYPE)
html {
- (page_header(serve_path, color_scheme, file_upload, false))
+ (page_header(display_dir, color_scheme, file_upload, false))
body#drop-container {
@if file_upload {
div.drag-form {
@@ -50,7 +51,7 @@ pub fn page(
(color_scheme_selector(sort_method, sort_order, color_scheme, default_color_scheme, serve_path, show_qrcode))
div.container {
span#top { }
- h1.title { "Index of " (serve_path) }
+ h1.title { "Index of " (display_dir) }
div.toolbar {
@if tar_enabled || zip_enabled {
div.download {
@@ -75,9 +76,9 @@ pub fn page(
}
table {
thead {
- th { (build_link("name", "Name", sort_method, sort_order, color_scheme, default_color_scheme)) }
- th { (build_link("size", "Size", sort_method, sort_order, color_scheme, default_color_scheme)) }
- th { (build_link("date", "Last modification", sort_method, sort_order, color_scheme, default_color_scheme)) }
+ th.name { (build_link("name", "Name", sort_method, sort_order, color_scheme, default_color_scheme)) }
+ th.size { (build_link("size", "Size", sort_method, sort_order, color_scheme, default_color_scheme)) }
+ th.date { (build_link("date", "Last modification", sort_method, sort_order, color_scheme, default_color_scheme)) }
}
tbody {
@if !is_root {
@@ -107,13 +108,13 @@ pub fn page(
/// Build the action of the upload form
fn build_upload_action(
upload_route: &str,
- current_dir: &str,
+ encoded_dir: &str,
sort_method: Option<SortingMethod>,
sort_order: Option<SortingOrder>,
color_scheme: ColorScheme,
default_color_scheme: ColorScheme,
) -> String {
- let mut upload_action = format!("{}?path={}", upload_route, current_dir);
+ let mut upload_action = format!("{}?path={}", upload_route, encoded_dir);
if let Some(sorting_method) = sort_method {
upload_action = format!("{}&sort={}", upload_action, &sorting_method);
}
@@ -352,7 +353,7 @@ fn entry_row(
}
}
}
- td {
+ td.size-cell {
@if let Some(size) = entry.size {
(size)
}
@@ -533,12 +534,17 @@ fn css(color_scheme: ColorScheme) -> Markup {
color: {table_text_color};
text-align: left;
line-height: 1.125rem;
- width: 33.333%;
}}
table thead tr th {{
padding: 0.5rem 0.625rem 0.625rem;
font-weight: bold;
}}
+ table thead th.size {{
+ width: 6em;
+ }}
+ table thead th.date {{
+ width: 15em;
+ }}
table tbody tr:nth-child(odd) {{
background: {odd_row_background};
}}
@@ -551,9 +557,11 @@ fn css(color_scheme: ColorScheme) -> Markup {
table tbody tr:hover {{
background: {active_row_color};
}}
+ td.size-cell {{
+ text-align: right;
+ }}
td.date-cell {{
display: flex;
- width: calc(100% - 1.25rem);
justify-content: space-between;
}}
.at {{