Skip to content

Commit

Permalink
Show site description in main page (#42)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti authored Nov 14, 2024
1 parent cd5c7a9 commit ecef8ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/enterprise/enterprise_explorer.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,12 @@ explorer_start(const sourcemeta::hydra::http::ServerRequest &request,
html << "</div>";
html << "</nav>";

html << "<div class=\"container-fluid p-4\">";
return html;
}

static auto explorer_end(std::ostringstream &html,
sourcemeta::hydra::http::ServerResponse &response,
const sourcemeta::hydra::http::Status code) -> void {
html << "</div>";
html << "</body>";
html << "</html>";

Expand Down Expand Up @@ -162,8 +160,17 @@ 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 << "<div class=\"container-fluid px-4 py-2 bg-light bg-gradient "
"border-bottom\">";
html << "<p class=\"mb-0 text-secondary fw-light\">";
html << description << "\n";
html << "</p>";
html << "</div>";

html << "<div class=\"container-fluid p-4\">";
file_manager(html, sourcemeta::registry::path_join(schema_base_directory,
request.path()));
html << "</div>";
explorer_end(html, response, sourcemeta::hydra::http::Status::OK);
}

Expand All @@ -175,7 +182,9 @@ 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 << "<div class=\"container-fluid p-4\">";
file_manager(html, directory);
html << "</div>";
explorer_end(html, response, sourcemeta::hydra::http::Status::OK);
}

Expand All @@ -187,7 +196,9 @@ auto explore_not_found(const std::string &site_name,
std::ostringstream html{
explorer_start(request, server_base_url, site_name, "Not Found",
"What you are looking for is not here")};
html << "<div class=\"container-fluid p-4\">";
html << "Not Found";
html << "</div>";
explorer_end(html, response, sourcemeta::hydra::http::Status::NOT_FOUND);
}

Expand Down
2 changes: 2 additions & 0 deletions src/enterprise/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@import "../../vendor/bootstrap/scss/containers";
@import "../../vendor/bootstrap/scss/grid";

// TODO: Only include necessary components

@import "../../vendor/bootstrap/scss/tables";
@import "../../vendor/bootstrap/scss/forms";
@import "../../vendor/bootstrap/scss/buttons";
Expand Down

0 comments on commit ecef8ad

Please sign in to comment.