Skip to content

Commit

Permalink
Merge pull request frappe#27417 from shariquerik/apps-switcher-fix
Browse files Browse the repository at this point in the history
fix: Redirect issue in apps switcher
  • Loading branch information
shariquerik committed Aug 16, 2024
2 parents 9ea66f6 + 903ffd8 commit d70190f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
7 changes: 3 additions & 4 deletions frappe/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
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"


def is_desk_apps(apps):
Expand Down
20 changes: 14 additions & 6 deletions frappe/www/apps.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
endblock -%} {%- block footer -%} {%- endblock -%} {% block content %}
<div class="container">
<div class="apps-container">
<div class="title">{{ _('Select the app to continue') }}</div>
<div class="title">{{ _('Select an app to continue') }}</div>
{% set appsCount = apps|length if apps|length <= 6 else 6 %}
<div class="apps" style="grid-template-columns: repeat({{ appsCount }}, 1fr);">
{% for app in apps %}
Expand All @@ -16,17 +16,17 @@
<div class="app-title">{{ app.title }}</div>
<div
app-name="{{ app.name }}"
class="set-default btn btn-xs {{ '' if app.is_default else 'hidden'}}"
title="set app as default"
class="set-default btn btn-sm {{ '' if app.is_default else 'hidden'}}"
title="Set as default"
>
<svg class="icon icon-sm">
<svg class="icon icon-md">
<use href="#icon-solid-success"></use>
</svg>
</div>
</a>
{% endfor %}
</div>
<a href="/api/method/web_logout" class="logout-btn btn btn-default">
<button class="logout-btn btn btn-default">
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
Expand All @@ -44,7 +44,7 @@
<line x1="21" x2="9" y1="12" y2="12" />
</svg>
<span> {{ _('Logout') }} </span>
</a>
</button>
</div>
</div>
{% endblock %}
Expand All @@ -62,5 +62,13 @@
}
});
});
$('.logout-btn').on('click', function() {
frappe.call({
method: 'logout',
callback: function() {
window.location.href = '/login';
}
});
});
</script>
{% endblock %}

0 comments on commit d70190f

Please sign in to comment.