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,7 +9,7 @@ class ProxyGitlabAppConfig(ColabProxiedAppConfig):
9 verbose_name = 'Gitlab Proxy' 9 verbose_name = 'Gitlab Proxy'
10 10
11 menu = { 11 menu = {
12 - 'title': _('Repository'), 12 + 'title': _('Code'),
13 'links': ( 13 'links': (
14 (_('Public Projects'), 'public/projects'), 14 (_('Public Projects'), 'public/projects'),
15 ), 15 ),
colab/proxy/templatetags/proxy.py
@@ -20,7 +20,7 @@ PROXY_MENU_ITEM_TEMPLATE = &quot;&quot;&quot; @@ -20,7 +20,7 @@ PROXY_MENU_ITEM_TEMPLATE = &quot;&quot;&quot;
20 20
21 @register.simple_tag(takes_context=True) 21 @register.simple_tag(takes_context=True)
22 def proxy_menu(context): 22 def proxy_menu(context):
23 - menu = '' 23 + menu_links = {}
24 proxied_apps = context.get('proxy', {}) 24 proxied_apps = context.get('proxy', {})
25 25
26 for app in proxied_apps.values(): 26 for app in proxied_apps.values():
@@ -35,11 +35,19 @@ def proxy_menu(context): @@ -35,11 +35,19 @@ def proxy_menu(context):
35 if not links: 35 if not links:
36 continue 36 continue
37 37
38 - items = '' 38 + if title not in menu_links:
  39 + menu_links[title] = []
39 40
40 for text, link in links: 41 for text, link in links:
41 url = reverse(app.label, args=(link,)) 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 link_title=unicode(text)) 51 link_title=unicode(text))
44 menu += PROXY_MENU_TEMPLATE.format(title=unicode(title), items=items) 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,7 +9,7 @@ class ProxyTracAppConfig(ColabProxiedAppConfig):
9 verbose_name = 'Trac Proxy' 9 verbose_name = 'Trac Proxy'
10 10
11 menu = { 11 menu = {
12 - 'title': _('Contribute'), 12 + 'title': _('Code'),
13 'links': ( 13 'links': (
14 (_('Timeline'), 'timeline'), 14 (_('Timeline'), 'timeline'),
15 (_('Wiki'), 'wiki'), 15 (_('Wiki'), 'wiki'),