diff --git a/src/postorius/templatetags/bootstrap_tags.py b/src/postorius/templatetags/bootstrap_tags.py new file mode 100644 index 0000000..a65eaad --- /dev/null +++ b/src/postorius/templatetags/bootstrap_tags.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 1998-2015 by the Free Software Foundation, Inc. +# +# This file is part of Postorius. +# +# Postorius is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# Postorius is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# Postorius. If not, see . + +from django.core.urlresolvers import reverse +from django import template + + +register = template.Library() + +@register.filter(name='add_form_control') +def add_form_control(field): + return field.as_widget(attrs={'class': 'form-control'}) + +@register.filter('fieldtype') +def fieldtype(field): + return field.field.widget.__class__.__name__ \ No newline at end of file diff --git a/src/postorius/templatetags/nav_helpers.py b/src/postorius/templatetags/nav_helpers.py index 440ab91..198050b 100644 --- a/src/postorius/templatetags/nav_helpers.py +++ b/src/postorius/templatetags/nav_helpers.py @@ -33,6 +33,15 @@ title=title) +@register.inclusion_tag('postorius/menu/user_nav.html', takes_context=True) +def user_nav(context, current, title=None): + if title is None: + title = '' + return dict(current=current, + user=context['request'].user, + title=title) + + @register.simple_tag def page_url(view_name, *args, **kwargs): return reverse(view_name, *args, **kwargs) @@ -41,5 +50,5 @@ @register.simple_tag(takes_context=True) def nav_active_class(context, current, view_name): if current == view_name: - return 'mm_active' + return 'active' return ''