From 48d1910d06d9a71db2e9707a7c2c1aa4929f2840 Mon Sep 17 00:00:00 2001 From: Jose Quintana <1700322+joseluisq@users.noreply.github.com> Date: Sat, 16 Sep 2023 03:53:16 +0200 Subject: [PATCH] refactor: improve responsiveness of directory listing html view (#260) it improves the responsiveness of the HTML view for large file/dir names on mobile and desktop screens. it fixes #259 --- src/directory_listing.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/directory_listing.rs b/src/directory_listing.rs index ac0551d..d6b81bf 100644 --- a/src/directory_listing.rs +++ b/src/directory_listing.rs @@ -118,9 +118,9 @@ pub fn auto_index( }) } -const STYLE: &str = r#""#; +const STYLE: &str = r#""#; const FOOTER: &str = - r#""#; + r#""#; const DATETIME_FORMAT_UTC: &str = "%FT%TZ"; const DATETIME_FORMAT_LOCAL: &str = "%F %T"; @@ -428,7 +428,7 @@ fn html_auto_index<'a>( // Create the table header specifying every order code column let table_header = format!( - r#"NameLast modifiedSize"#, + r#"NameLast modifiedSize"#, sort_attrs.name, sort_attrs.last_modified, sort_attrs.size, ); @@ -460,12 +460,12 @@ fn html_auto_index<'a>( let current_path = percent_decode_str(base_path).decode_utf8()?.to_string(); let summary = format!( - "
directories: {}, files: {}
", + "

directories: {}, files: {}

", dirs_count, files_count, ); let html_page = format!( - "Index of {current_path}{STYLE}

Index of {current_path}

{summary}
{table_header}{table_row}

{FOOTER}" + "Index of {current_path}{STYLE}

Index of {current_path}

{summary}
{table_header}{table_row}

{FOOTER}" ); Ok(html_page) -- libgit2 1.7.2