Skip to content

Commit

Permalink
Update Wiki Sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
Talleyrand333 committed Aug 29, 2023
1 parent 6b8400f commit 8e8381d
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions one_wiki/overrides/wiki_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,30 +95,28 @@ def get_sidebar_items_(self):

for sidebar_item in wiki_sidebar:
wiki_page = frappe.get_doc("Wiki Page", sidebar_item.wiki_page)
wiki_language = frappe.cache().get_value(f'wiki_language_{frappe.session.user}')
if wiki_language in ['en','ar']:
wiki_language_dict = {'en':'English','ar':'عربي'}
if wiki_page.language == wiki_language_dict[wiki_language]:
if sidebar_item.parent_label not in sidebar:
sidebar[sidebar_item.parent_label] = [
{
"name": wiki_page.name,
"type": "Wiki Page",
"title": wiki_page.title,
"route": wiki_page.route,
"group_name": sidebar_item.parent_label,
}
]
else:
sidebar[sidebar_item.parent_label] += [
{
"name": wiki_page.name,
"type": "Wiki Page",
"title": wiki_page.title,
"route": wiki_page.route,
"group_name": sidebar_item.parent_label,
}
]
wiki_language = self.language or 'English'
if wiki_page.language == wiki_language:
if sidebar_item.parent_label not in sidebar:
sidebar[sidebar_item.parent_label] = [
{
"name": wiki_page.name,
"type": "Wiki Page",
"title": wiki_page.title,
"route": wiki_page.route,
"group_name": sidebar_item.parent_label,
}
]
else:
sidebar[sidebar_item.parent_label] += [
{
"name": wiki_page.name,
"type": "Wiki Page",
"title": wiki_page.title,
"route": wiki_page.route,
"group_name": sidebar_item.parent_label,
}
]

return self.get_items(sidebar)

Expand Down

0 comments on commit 8e8381d

Please sign in to comment.