diff --git a/wiki/patches.txt b/wiki/patches.txt index fb6b6da1..6c52ddf5 100644 --- a/wiki/patches.txt +++ b/wiki/patches.txt @@ -9,4 +9,5 @@ wiki.wiki.doctype.wiki_space.patches.wiki_sidebar_migration wiki.wiki.doctype.wiki_settings.patches.wiki_navbar_item_migration wiki.wiki.doctype.wiki_page.patches.convert_wiki_content_to_markdown wiki.wiki.doctype.wiki_page.patches.update_escaped_code_content -wiki.wiki.doctype.wiki_page.patches.update_escaped_chars \ No newline at end of file +wiki.wiki.doctype.wiki_page.patches.update_escaped_chars +wiki.wiki.doctype.wiki_space.patches.wiki_navbar_app_switcher_migration \ No newline at end of file diff --git a/wiki/public/scss/dropdowns.scss b/wiki/public/scss/dropdowns.scss index b2121011..50e9c7ce 100644 --- a/wiki/public/scss/dropdowns.scss +++ b/wiki/public/scss/dropdowns.scss @@ -11,7 +11,8 @@ position: absolute; left: 10px; top: 100%; - background-color: var(--navbar-dropdown-bg-color); + background-color: var(--search-modal-bg-color); + color: var(--search-modal-color); width: 96%; border-radius: 8px; box-shadow: 0 10px 24px -3px #0000001a; @@ -30,20 +31,29 @@ .app-switcher { display: flex; flex-direction: column; - gap: 2px; + gap: 4px; font-size: 14px; padding: 10px; - height: 350px; + height: 100%; + max-height: 350px; overflow: auto; + font-weight: 500; } .space-link { padding: 4px; padding-left: 8px; + display: flex; + align-items: center; + gap: 8px; + + img { + width: 22px; + } } .space-link:hover { - background-color: var(--sidebar-hover-color); + background-color: var(--search-modal-hover-color); border-radius: 4px; } } diff --git a/wiki/wiki/doctype/wiki_page/templates/wiki_navbar.html b/wiki/wiki/doctype/wiki_page/templates/wiki_navbar.html index a2093924..65a7881d 100644 --- a/wiki/wiki/doctype/wiki_page/templates/wiki_navbar.html +++ b/wiki/wiki/doctype/wiki_page/templates/wiki_navbar.html @@ -12,6 +12,7 @@ {{ (frappe.get_hooks("brand_html") or [_("Home")])[0] }} {%- endif -%} + {% if spaces and spaces|length > 0 %} {% if navbar_search %} diff --git a/wiki/wiki/doctype/wiki_page/wiki_page.py b/wiki/wiki/doctype/wiki_page/wiki_page.py index 9a04d1bd..90fd2be6 100644 --- a/wiki/wiki/doctype/wiki_page/wiki_page.py +++ b/wiki/wiki/doctype/wiki_page/wiki_page.py @@ -206,10 +206,13 @@ def get_context(self, context): self.verify_permission() self.set_breadcrumbs(context) - allSpaces = get_all_spaces() + allSpaces = frappe.get_all( + "Wiki Space", + fields=["route", "space_name", "app_switcher_logo"], + filters={"show_in_navbar_app_switcher": 1}, + ) - filtered_spaces = [space for space in allSpaces if "/" not in space] - context.spaces = [{"url": space, "name": space.capitalize()} for space in filtered_spaces] + context.spaces = allSpaces wiki_settings = frappe.get_single("Wiki Settings") wiki_space_name = frappe.get_value("Wiki Group Item", {"wiki_page": self.name}, "parent") diff --git a/wiki/wiki/doctype/wiki_space/patches/wiki_navbar_app_switcher_migration.py b/wiki/wiki/doctype/wiki_space/patches/wiki_navbar_app_switcher_migration.py new file mode 100644 index 00000000..c60e4d29 --- /dev/null +++ b/wiki/wiki/doctype/wiki_space/patches/wiki_navbar_app_switcher_migration.py @@ -0,0 +1,10 @@ +import frappe + + +def execute(): + wiki_spaces = frappe.db.get_all("Wiki Space", fields=["*"]) + for space in wiki_spaces: + if space["space_name"] is None: + frappe.db.set_value( + "Wiki Space", space["name"], "space_name", space["route"].replace("/", " ").capitalize() + ) diff --git a/wiki/wiki/doctype/wiki_space/wiki_space.json b/wiki/wiki/doctype/wiki_space/wiki_space.json index 4715eb57..1d92a2d7 100644 --- a/wiki/wiki/doctype/wiki_space/wiki_space.json +++ b/wiki/wiki/doctype/wiki_space/wiki_space.json @@ -9,7 +9,10 @@ "engine": "InnoDB", "field_order": [ "general_tab", + "space_name", "route", + "show_in_navbar_app_switcher", + "app_switcher_logo", "wiki_sidebars", "navbar_tab", "logo_section", @@ -67,11 +70,29 @@ { "fieldname": "section_break_fhui", "fieldtype": "Section Break" + }, + { + "default": "0", + "fieldname": "show_in_navbar_app_switcher", + "fieldtype": "Check", + "label": "Show in navbar app switcher" + }, + { + "fieldname": "space_name", + "fieldtype": "Data", + "label": "Space Name" + }, + { + "depends_on": "eval:doc.show_in_navbar_app_switcher==1;", + "fieldname": "app_switcher_logo", + "fieldtype": "Attach Image", + "label": "App Switcher Logo", + "make_attachment_public": 1 } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2024-12-11 15:27:44.629602", + "modified": "2025-02-18 14:09:29.088972", "modified_by": "Administrator", "module": "Wiki", "name": "Wiki Space", diff --git a/wiki/www/app-icon.png b/wiki/www/app-icon.png new file mode 100644 index 00000000..b721adcd Binary files /dev/null and b/wiki/www/app-icon.png differ