better links to workspaces

This commit is contained in:
Mateusz Gruszczyński
2026-07-31 14:29:37 +02:00
parent c6e9a3dd43
commit eab9d5c7b6
5 changed files with 41 additions and 6 deletions
+17 -1
View File
@@ -26,9 +26,25 @@ fn render_editor_page(
protected_resource_label: &str,
extra_shortcuts: &str,
) -> Response {
let (resource_aria_label, resource_breadcrumb) = if resource_kind == "note" {
(
"RustPad Workspace Note",
format!(
r#"<a id="resource-parent-link" class="resource-brand__kind" href="{}">Workspace</a><span class="resource-brand__separator" aria-hidden="true">/</span><span class="resource-brand__kind resource-brand__kind--current" aria-current="page">Note</span>"#,
escape_html(parent_url)
),
)
} else {
(
"RustPad Note",
r#"<span class="resource-brand__kind resource-brand__kind--current" aria-current="page">Note</span>"#.to_string(),
)
};
let html = include_str!("../../static/editor.html")
.replace("__RESOURCE_KIND__", resource_kind)
.replace("__RESOURCE_LABEL__", "Note")
.replace("__RESOURCE_ARIA_LABEL__", resource_aria_label)
.replace("__RESOURCE_BREADCRUMB__", &resource_breadcrumb)
.replace("__DOCUMENT_TITLE__", &escape_html(document_title))
.replace("__PARENT_TITLE__", &escape_html(parent_title))
.replace("__PARENT_URL__", &escape_html(parent_url))