Commit a191a186d9ef3ea206a889bf72f967d8421ece62
1 parent
f7fe1908
Exists in
master
and in
39 other branches
Group links with same title
Signed-off-by: Lucas Kanashiro <kanashiro.duarte@gmail.com> Signed-off-by: Sergio Oliveira <seocam@gmail.com>
Showing
3 changed files
with
13 additions
and
5 deletions
Show diff stats
colab/proxy/gitlab/apps.py
colab/proxy/templatetags/proxy.py
... | ... | @@ -20,7 +20,7 @@ PROXY_MENU_ITEM_TEMPLATE = """ |
20 | 20 | |
21 | 21 | @register.simple_tag(takes_context=True) |
22 | 22 | def proxy_menu(context): |
23 | - menu = '' | |
23 | + menu_links = {} | |
24 | 24 | proxied_apps = context.get('proxy', {}) |
25 | 25 | |
26 | 26 | for app in proxied_apps.values(): |
... | ... | @@ -35,11 +35,19 @@ def proxy_menu(context): |
35 | 35 | if not links: |
36 | 36 | continue |
37 | 37 | |
38 | - items = '' | |
38 | + if title not in menu_links: | |
39 | + menu_links[title] = [] | |
39 | 40 | |
40 | 41 | for text, link in links: |
41 | 42 | url = reverse(app.label, args=(link,)) |
42 | - items += PROXY_MENU_ITEM_TEMPLATE.format(link=url, | |
43 | + menu_links[title].append((text, url)) | |
44 | + | |
45 | + menu = '' | |
46 | + | |
47 | + for title, links in menu_links.items(): | |
48 | + items = '' | |
49 | + for text, link in links: | |
50 | + items += PROXY_MENU_ITEM_TEMPLATE.format(link=link, | |
43 | 51 | link_title=unicode(text)) |
44 | 52 | menu += PROXY_MENU_TEMPLATE.format(title=unicode(title), items=items) |
45 | 53 | ... | ... |
colab/proxy/trac/apps.py