From 11c366ec14d24491c3580283722f9f0cfb237a8f Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Thu, 14 Nov 2024 09:31:28 -0400 Subject: [PATCH] Implement a proper HTML breadcrumb Signed-off-by: Juan Cruz Viotti --- src/enterprise/enterprise_explorer.h | 55 ++++++++++++++++++++++------ src/enterprise/style.scss | 2 + 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/src/enterprise/enterprise_explorer.h b/src/enterprise/enterprise_explorer.h index 215aae7..866e477 100644 --- a/src/enterprise/enterprise_explorer.h +++ b/src/enterprise/enterprise_explorer.h @@ -79,6 +79,49 @@ static auto file_manager(std::ostringstream &html, const auto meta_path{directory / ".meta.json"}; assert(std::filesystem::exists(meta_path)); const auto meta{sourcemeta::jsontoolkit::from_file(meta_path)}; + + assert(meta.defines("breadcrumb")); + assert(meta.at("breadcrumb").is_array()); + if (!meta.at("breadcrumb").empty()) { + html << ""; + } + + // html << "

"; + // html << "XXXXX" << "\n"; + // html << "

"; + + html << "
"; html << ""; @@ -148,6 +191,7 @@ static auto file_manager(std::ostringstream &html, html << ""; html << "
"; + html << "
"; } namespace sourcemeta::registry::enterprise { @@ -160,17 +204,8 @@ auto explore_index(const std::string &site_name, const std::string &title, sourcemeta::hydra::http::ServerResponse &response) -> void { std::ostringstream html{ explorer_start(request, server_base_url, site_name, title, description)}; - html << "
"; - html << "

"; - html << description << "\n"; - html << "

"; - html << "
"; - - html << "
"; file_manager(html, sourcemeta::registry::path_join(schema_base_directory, request.path())); - html << "
"; explorer_end(html, response, sourcemeta::hydra::http::Status::OK); } @@ -182,9 +217,7 @@ auto explore_directory(const std::string &site_name, -> void { std::ostringstream html{explorer_start(request, server_base_url, site_name, request.path(), request.path())}; - html << "
"; file_manager(html, directory); - html << "
"; explorer_end(html, response, sourcemeta::hydra::http::Status::OK); } diff --git a/src/enterprise/style.scss b/src/enterprise/style.scss index cb8ec32..015e120 100644 --- a/src/enterprise/style.scss +++ b/src/enterprise/style.scss @@ -1,5 +1,7 @@ @import "../../vendor/bootstrap/scss/functions"; +$breadcrumb-font-size: 15px; + @import "../../vendor/bootstrap/scss/variables"; @import "../../vendor/bootstrap/scss/variables-dark"; @import "../../vendor/bootstrap/scss/maps";