Skip to content

Commit

Permalink
Merge pull request pulse-mind#3 from kdabiedeen/v2
Browse files Browse the repository at this point in the history
Handle `available_apps` being none
  • Loading branch information
kdabiedeen authored Jan 24, 2022
2 parents 97ffc22 + 0f1242c commit f671461
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions suit/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ def map_native_apps(self):
"""
Make dictionary of native apps and models for easier matching
"""
if not self.available_apps:
return

for native_app in self.available_apps:
app_key = native_app['app_url'].split('/')[-2]
self._available_apps['apps'][app_key] = native_app
Expand Down Expand Up @@ -141,6 +144,9 @@ def find_native_model(self, native_app, child_item):

def build_menu_by_available_apps(self):
menu_items = []
if not self.available_apps:
return

for native_app in self.available_apps:
parent_item = self.make_parent_from_native_app(native_app)
menu_items.append(parent_item)
Expand Down
2 changes: 1 addition & 1 deletion suit/templates/suit/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% with suit_layout='layout'|suit_conf:request %}
<div id="suit-nav">
<ul>
{% if menu %}
{% if menu and menu|length > 0 %}
{% for parent_item in menu %}
{% if not parent_item.align_right or suit_layout == 'vertical' %}
{% include 'suit/menu_item.html' %}
Expand Down

0 comments on commit f671461

Please sign in to comment.