Skip to content

Commit

Permalink
Basic HTML layout improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti committed Nov 13, 2024
1 parent 7684a14 commit 03fb7fe
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/enterprise/enterprise_explorer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,26 @@ explorer_start(const sourcemeta::hydra::http::ServerRequest &request,

html << "</head>";
html << "<body class=\"h-100\">";

html << "<nav class=\"navbar navbar-expand border-bottom bg-body p-3\">";
html << "<div class=\"container-fluid\">";
html << "<a class=\"navbar-brand\" href=\"" << server_base_url << "\">";
html << "<img src=\"/icon.svg\" alt=\"" << title
<< "\" height=\"30\" width=\"30\" class=\"me-2\">";
html << "<span class=\"align-middle fw-bold\">" << title << "</span>";
html << "<span class=\"align-middle fw-lighter\"> Schemas</span>";
html << "</a>";
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 @@ -126,10 +140,8 @@ auto explore_index(const std::string &title, const std::string &description,
sourcemeta::hydra::http::ServerResponse &response) -> void {
std::ostringstream html{
explorer_start(request, server_base_url, title, description)};
html << "<div class=\"container\">";
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 @@ -140,9 +152,7 @@ auto explore_not_found(const std::string &server_base_url,
std::ostringstream html{
explorer_start(request, server_base_url, "Not Found",
"What you are looking for is not here")};
html << "<div class=\"container\">";
html << "Not Found";
html << "</div>";
explorer_end(html, response, sourcemeta::hydra::http::Status::NOT_FOUND);
}

Expand Down

0 comments on commit 03fb7fe

Please sign in to comment.