Skip to content

Commit

Permalink
fix(Workspace): translatable sidebar sections (frappe#27281)
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra authored Aug 22, 2024
1 parent 3eeeab7 commit f7fb0d7
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions frappe/public/js/frappe/views/workspace/workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ frappe.views.Workspace = class Workspace {
public: {},
private: {},
};
this.sidebar_categories = ["My Workspaces", "Public"];
this.sidebar_categories = [
{ id: "Personal", label: __("Personal", null, "Workspace Category") },
{ id: "Public", label: __("Public", null, "Workspace Category") },
];
this.indicator_colors = [
"green",
"cyan",
Expand Down Expand Up @@ -193,7 +196,7 @@ frappe.views.Workspace = class Workspace {
let root_pages = this.public_pages.filter(
(page) => page.parent_page == "" || page.parent_page == null
);
if (category != "Public") {
if (category.id != "Public") {
root_pages = this.private_pages.filter(
(page) => page.parent_page == "" || page.parent_page == null
);
Expand All @@ -210,17 +213,17 @@ frappe.views.Workspace = class Workspace {
this.remove_sidebar_skeleton();
}

build_sidebar_section(title, root_pages) {
build_sidebar_section(category, root_pages) {
let sidebar_section = $(
`<div class="standard-sidebar-section nested-container" data-title="${title}"></div>`
`<div class="standard-sidebar-section nested-container" data-title="${category.id}"></div>`
);

let $title = $(`<button class="btn-reset standard-sidebar-label">
<span>${frappe.utils.icon("es-line-down", "xs")}</span>
<span class="section-title">${__(title)}<span>
<span class="section-title">${category.label}<span>
</div>`).appendTo(sidebar_section);
$title.attr({
"aria-label": __("{0}: {1}", [__("Toggle Section"), __(title)]),
"aria-label": __("Toggle Section: {0}", [category.label]),
"aria-expanded": "true",
});
this.prepare_sidebar(root_pages, sidebar_section, this.sidebar);
Expand Down

0 comments on commit f7fb0d7

Please sign in to comment.