Skip to content

Commit cb9f907

Browse files
authored
[ISSUE 1988] moving the About menu to the user menu (#1989)
* moving About menu to the user menu * update the menu according to the rescrictions of the admin users * remove the About button from the topbar menu * keeping the TOPBAR_MENU_RIGHT variable
1 parent 921e354 commit cb9f907

File tree

2 files changed

+26
-49
lines changed

2 files changed

+26
-49
lines changed

geonode_mapstore_client/templates/geonode-mapstore-client/snippets/topbar.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
{% get_base_left_topbar_menu as BASE_TOPBAR_MENU_LEFT %}
33
{% get_menu_json 'TOPBAR_MENU' as TOPBAR_MENU %}
44
{% get_menu_json 'TOPBAR_MENU_LEFT' as TOPBAR_MENU_LEFT %}
5-
{% get_base_right_topbar_menu as BASE_TOPBAR_MENU_RIGHT %}
65
{% get_menu_json 'TOPBAR_MENU_RIGHT' as TOPBAR_MENU_RIGHT %}
76

87
<nav id="{{ id|default:'' }}" class="gn-menu gn-primary" data-gn-menu-resize="true">
@@ -57,13 +56,10 @@
5756
<div class="gn-menu-content-right">
5857
{% block right_menu %}
5958
<ul class="gn-menu-list">
60-
{% for menu_item in BASE_TOPBAR_MENU_RIGHT %}
61-
{% include './menu_item.html' with menu_item=menu_item variant='primary' align_right=True %}
62-
{% endfor %}
6359
{% for menu_item in TOPBAR_MENU_RIGHT %}
6460
{% include './menu_item.html' with menu_item=menu_item variant='primary' align_right=True %}
6561
{% endfor %}
66-
62+
6763
{% block language_selector %}
6864
{% include './language_selector.html' with variant='primary' align_right=True %}
6965
{% endblock %}

geonode_mapstore_client/templatetags/get_menu_json.py

Lines changed: 25 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -65,49 +65,6 @@ def get_base_left_topbar_menu():
6565
}
6666
]
6767

68-
69-
@register.simple_tag(takes_context=True)
70-
def get_base_right_topbar_menu(context):
71-
is_mobile = _is_mobile_device(context)
72-
73-
if is_mobile:
74-
return []
75-
76-
about = {
77-
"label": "About",
78-
"type": "dropdown",
79-
"items": [
80-
{"type": "link", "href": "/people/", "label": "People"},
81-
{"type": "link", "href": "/groups/", "label": "Groups"},
82-
],
83-
}
84-
85-
user = _get_request_user(context)
86-
87-
if user and user.is_authenticated and not Configuration.load().read_only:
88-
about["items"].extend(
89-
[
90-
{"type": "divider"},
91-
{
92-
"type": "link",
93-
"href": "/invitations/geonode-send-invite/",
94-
"label": "Invite users",
95-
},
96-
{
97-
"type": "link",
98-
"href": "/admin/people/profile/add/",
99-
"label": "Add user",
100-
}
101-
if user.is_superuser
102-
else None,
103-
{"type": "link", "href": "/groups/create/", "label": "Create group"}
104-
if user.is_superuser
105-
else None,
106-
]
107-
)
108-
return [about]
109-
110-
11168
@register.simple_tag(takes_context=True)
11269
def get_user_menu(context):
11370
is_mobile = _is_mobile_device(context)
@@ -165,7 +122,31 @@ def get_user_menu(context):
165122
devider,
166123
],
167124
}
168-
general = [{"type": "link", "href": "/help/", "label": "Help"}, devider, logout]
125+
126+
people_groups = [
127+
{"type": "link", "href": "/people/", "label": "People"},
128+
{"type": "link", "href": "/groups/", "label": "Groups"},
129+
devider
130+
]
131+
132+
if user.is_superuser:
133+
people_groups.extend(
134+
[
135+
{"type": "link", "href": "/invitations/geonode-send-invite/", "label": "Invite users"},
136+
{"type": "link","href": "/admin/people/profile/add/","label": "Add user"},
137+
{"type": "link", "href": "/groups/create/", "label": "Create group"},
138+
devider
139+
]
140+
)
141+
142+
general = (
143+
people_groups + [
144+
{"type": "link", "href": "/help/", "label": "Help"},
145+
devider,
146+
logout
147+
]
148+
)
149+
169150
monitoring = []
170151
if settings.MONITORING_ENABLED:
171152
monitoring = [

0 commit comments

Comments
 (0)