From 0d6ecfbd2220c19fa611a048b1414888cd4f1dff Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 16 Aug 2024 14:22:51 +0530 Subject: [PATCH 1/4] fix: redirect to /login if logged out from apps page --- frappe/www/apps.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frappe/www/apps.html b/frappe/www/apps.html index df3a1640230f..ab0fa4489c3a 100644 --- a/frappe/www/apps.html +++ b/frappe/www/apps.html @@ -26,7 +26,7 @@ {% endfor %} - + {% endblock %} @@ -62,5 +62,13 @@ } }); }); + $('.logout-btn').on('click', function() { + frappe.call({ + method: 'logout', + callback: function() { + window.location.href = '/login'; + } + }); + }); {% endblock %} From 14b9800bafeb9f58e3785a5d260e8c6590007c42 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 16 Aug 2024 14:23:20 +0530 Subject: [PATCH 2/4] fix: redirect to default app is not working --- frappe/apps.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frappe/apps.py b/frappe/apps.py index 14d731d56415..3f5ba4abda20 100644 --- a/frappe/apps.py +++ b/frappe/apps.py @@ -33,10 +33,9 @@ def get_apps(): def get_route(app_name): - hooks = frappe.get_hooks(app_name=app_name) - if hooks.get("app_icon_route"): - return hooks.get("app_icon_route")[0] - return "/apps" + links = frappe.get_hooks("add_to_apps_screen", app_name=app_name) + app = next((link for link in links if link.get("name") == app_name), None) + return app.get("route") if app and app.get("route") else "/apps" def is_desk_apps(apps): From c4a8d112d8179ef1e5c0645f7a82500de841d307 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 16 Aug 2024 14:36:12 +0530 Subject: [PATCH 3/4] chore: apps title --- frappe/www/apps.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frappe/www/apps.html b/frappe/www/apps.html index ab0fa4489c3a..90088a4413f1 100644 --- a/frappe/www/apps.html +++ b/frappe/www/apps.html @@ -7,7 +7,7 @@ endblock -%} {%- block footer -%} {%- endblock -%} {% block content %}
-
{{ _('Select the app to continue') }}
+
{{ _('Select an app to continue') }}
{% set appsCount = apps|length if apps|length <= 6 else 6 %}
{% for app in apps %} @@ -16,10 +16,10 @@
{{ app.title }}
- +
From 903ffd804cce34d86d2c17471f0485ac8deb75f9 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 16 Aug 2024 15:12:21 +0530 Subject: [PATCH 4/4] chore: corrected variable name --- frappe/apps.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe/apps.py b/frappe/apps.py index 3f5ba4abda20..f89265e6b392 100644 --- a/frappe/apps.py +++ b/frappe/apps.py @@ -33,8 +33,8 @@ def get_apps(): def get_route(app_name): - links = frappe.get_hooks("add_to_apps_screen", app_name=app_name) - app = next((link for link in links if link.get("name") == app_name), None) + apps = frappe.get_hooks("add_to_apps_screen", app_name=app_name) + app = next((app for app in apps if app.get("name") == app_name), None) return app.get("route") if app and app.get("route") else "/apps"