Commit a191a186d9ef3ea206a889bf72f967d8421ece62

Authored by Sergio Oliveira
1 parent f7fe1908

Group links with same title

Signed-off-by: Lucas Kanashiro <kanashiro.duarte@gmail.com>
Signed-off-by: Sergio Oliveira <seocam@gmail.com>
colab/proxy/gitlab/apps.py
... ... @@ -9,7 +9,7 @@ class ProxyGitlabAppConfig(ColabProxiedAppConfig):
9 9 verbose_name = 'Gitlab Proxy'
10 10  
11 11 menu = {
12   - 'title': _('Repository'),
  12 + 'title': _('Code'),
13 13 'links': (
14 14 (_('Public Projects'), 'public/projects'),
15 15 ),
... ...
colab/proxy/templatetags/proxy.py
... ... @@ -20,7 +20,7 @@ PROXY_MENU_ITEM_TEMPLATE = &quot;&quot;&quot;
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
... ... @@ -9,7 +9,7 @@ class ProxyTracAppConfig(ColabProxiedAppConfig):
9 9 verbose_name = 'Trac Proxy'
10 10  
11 11 menu = {
12   - 'title': _('Contribute'),
  12 + 'title': _('Code'),
13 13 'links': (
14 14 (_('Timeline'), 'timeline'),
15 15 (_('Wiki'), 'wiki'),
... ...