Skip to content

Commit d51649b

Browse files
committed
[chores] Added help icon
1 parent cf3eb1f commit d51649b

File tree

4 files changed

+74
-8
lines changed

4 files changed

+74
-8
lines changed

openwisp_utils/admin_theme/menu.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,9 @@ def __init__(self, config):
103103
raise ImproperlyConfigured(
104104
f'"url" should be a type of "str". Error for the config- {config}'
105105
)
106-
self.url = self.make_django_url(url)
106+
self.url = url
107107
self.icon = config.get('icon')
108108

109-
def make_django_url(self, url):
110-
# Add "/" at the end of link
111-
if url[-1] != '/':
112-
return url + '/'
113-
return url
114-
115109

116110
class MenuGroup(BaseMenuItem):
117111
"""

openwisp_utils/admin_theme/static/admin/css/openwisp.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,6 +1470,10 @@ body::-webkit-scrollbar {
14701470
mask-image: url(../../ui/openwisp/images/logout.svg);
14711471
-webkit-mask-image: url(../../ui/openwisp/images/logout.svg);
14721472
}
1473+
.ow-help {
1474+
mask-image: url(../../ui/openwisp/images/help.svg);
1475+
-webkit-mask-image: url(../../ui/openwisp/images/help.svg);
1476+
}
14731477

14741478
/* USERS ICONS */
14751479

Lines changed: 61 additions & 0 deletions
Loading

tests/test_project/tests/test_menu.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def test_menu_link(self):
204204
menu_link = MenuLink(config=_config)
205205
context = menu_link.create_context()
206206
self.assertEqual(context.get('label'), _config['label'])
207-
self.assertEqual(context.get('url'), _config['url'] + '/')
207+
self.assertEqual(context.get('url'), _config['url'])
208208
self.assertEqual(context.get('icon'), _config['icon'])
209209

210210
with self.subTest('Menu Link without icon'):
@@ -213,6 +213,13 @@ def test_menu_link(self):
213213
context = menu_link.create_context()
214214
self.assertEqual(context.get('icon'), None)
215215

216+
with self.subTest('Menu Link test mailto'):
217+
mailto = 'mailto:[email protected]'
218+
_config = self._get_menu_link_config(url=mailto)
219+
menu_link = MenuLink(config=_config)
220+
context = menu_link.create_context()
221+
self.assertEqual(context.get('url'), mailto)
222+
216223
def test_model_link(self):
217224

218225
with self.subTest('Model Link without name'):

0 commit comments

Comments
 (0)