-@register.filter
-@stringfilter
-def wiki_title(value):
- parts = (p.replace('_', ' ').title() for p in split_name(value))
- return ' / '.join(parts)
+class Tab(object):
+ slug = None
+ caption = None
+ url = None
+
+ def __init__(self, slug, caption, url):
+ self.slug = slug
+ self.caption = caption
+ self.url = url
+
+
+@register.inclusion_tag("wiki/main_tabs.html", takes_context=True)
+def main_tabs(context):
+ active = getattr(context['request'], 'wiki_active_tab', None)
+
+ tabs = []
+ user = context['user']
+ if user.is_authenticated():
+ tabs.append(Tab('my', _('Assigned to me'), reverse("wiki_user")))
+
+ tabs.append(Tab('unassigned', _('Unassigned'), reverse("wiki_unassigned")))
+ tabs.append(Tab('all', _('All'), reverse("wiki_document_list")))
+ tabs.append(Tab('create', _('Add'), reverse("wiki_create_missing")))
+ tabs.append(Tab('upload', _('Upload'), reverse("wiki_upload")))
+
+ if user.is_staff:
+ tabs.append(Tab('admin', _('Admin'), reverse("admin:index")))
+
+ return {"tabs": tabs, "active_tab": active}