1 from __future__ import absolute_import
3 from django.core.urlresolvers import reverse
4 from django.template.defaultfilters import stringfilter
5 from django import template
6 from django.utils.translation import ugettext as _
9 register = template.Library()
17 def __init__(self, slug, caption, url):
19 self.caption = caption
23 @register.inclusion_tag("wiki/main_tabs.html", takes_context=True)
24 def main_tabs(context):
25 active = getattr(context['request'], 'wiki_active_tab', None)
28 user = context['user']
29 if user.is_authenticated():
30 tabs.append(Tab('my', _('Assigned to me'), reverse("wiki_user")))
32 tabs.append(Tab('unassigned', _('Unassigned'), reverse("wiki_unassigned")))
33 tabs.append(Tab('users', _('Users'), reverse("wiki_users")))
34 tabs.append(Tab('all', _('All'), reverse("wiki_document_list")))
35 tabs.append(Tab('create', _('Add'), reverse("wiki_create_missing")))
36 tabs.append(Tab('upload', _('Upload'), reverse("wiki_upload")))
39 tabs.append(Tab('admin', _('Admin'), reverse("admin:index")))
41 return {"tabs": tabs, "active_tab": active}