django-navtag-2.1.3/0000755000175000017500000000000013266207567014515 5ustar chrischris00000000000000django-navtag-2.1.3/setup.cfg0000644000175000017500000000221313266207567016334 0ustar chrischris00000000000000[metadata] name = django-navtag version = 2.1.3 description = A simple Django navigation template tag long_description = file: README.rst author = Chris Beaven author_email = smileychris@gmail.com url = https://github.com/SmileyChris/django-navtag keywords = django, templates license = MIT classifiers = Development Status :: 5 - Production/Stable Environment :: Web Environment Intended Audience :: Developers License :: OSI Approved :: MIT License Operating System :: OS Independent Programming Language :: Python Programming Language :: Python :: 2.7 Programming Language :: Python :: 3.4 Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 Framework :: Django [options] zip_safe = False include_package_data = True packages = find: [options.extras_require] maintainer = zest.releaser[recommended] dev = tox django pytest pytest-django test = pytest pytest-django pytest-cov [bdist_wheel] universal = 1 [coverage:run] source = django_navtag [zest.releaser] tag-signing = yes [tool:pytest] django_settings_module = django_navtag.tests.settings filterwarnings = module [egg_info] tag_build = tag_date = 0 django-navtag-2.1.3/LICENSE0000644000175000017500000000204113266207566015516 0ustar chrischris00000000000000Copyright (c) 2013, Chris Beaven Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. django-navtag-2.1.3/django_navtag/0000755000175000017500000000000013266207567017317 5ustar chrischris00000000000000django-navtag-2.1.3/django_navtag/tests/0000755000175000017500000000000013266207567020461 5ustar chrischris00000000000000django-navtag-2.1.3/django_navtag/tests/test_navtag.py0000644000175000017500000001304113266207566023350 0ustar chrischris00000000000000from django import template from django.test import TestCase from django.template.loader import render_to_string from django_navtag.templatetags.navtag import NavNode BASIC_TEMPLATE = ''' {% load navtag %} {% nav "banana" %} {% if nav.apple %}Apple{% endif %} {% if nav.banana %}Banana{% endif %} ''' FOR_TEMPLATE = ''' {% load navtag %} {% nav "banana" for othernav %} {% if othernav.apple %}Apple{% endif %} {% if othernav.banana %}Banana{% endif %} ''' class NavTagTest(TestCase): def test_basic(self): t = template.Template(BASIC_TEMPLATE) content = t.render(template.Context()).strip() self.assertNotIn('Apple', content) self.assertIn('Banana', content) def test_for(self): t = template.Template(FOR_TEMPLATE) content = t.render(template.Context()).strip() self.assertNotIn('Apple', content) self.assertIn('Banana', content) def test_basic_extends(self): content = render_to_string('navtag_tests/home.txt').strip() self.assertIn('- Home (active)', content) self.assertNotIn('- Contact (active)', content) content = render_to_string('navtag_tests/contact.txt').strip() self.assertNotIn('- Home (active)', content) self.assertIn('- Contact (active)', content) def test_unset(self): content = render_to_string('navtag_tests/home.txt').strip() self.assertIn('- Home (active)', content) self.assertNotIn('- Contact (active)', content) content = render_to_string('navtag_tests/home-unset.txt').strip() self.assertNotIn('- Home (active)', content) self.assertNotIn('- Contact (active)', content) def test_heirarchical(self): content = render_to_string('navtag_tests/submenu/home.txt').strip() self.assertIn('- Home (active)', content) self.assertNotIn('- Fruit (active)', content) self.assertNotIn(' - Apple (active)', content) self.assertNotIn(' - Banana (active)', content) content = render_to_string( 'navtag_tests/submenu/base_fruit.txt').strip() self.assertNotIn('- Home (active)', content) self.assertIn('- Fruit (active)', content) self.assertNotIn(' - Apple (active)', content) self.assertNotIn(' - Banana (active)', content) content = render_to_string('navtag_tests/submenu/apple.txt').strip() self.assertNotIn('- Home (active)', content) self.assertIn('- Fruit (active)', content) self.assertIn(' - Apple (active)', content) self.assertNotIn(' - Banana (active)', content) content = render_to_string('navtag_tests/submenu/banana.txt').strip() self.assertNotIn('- Home (active)', content) self.assertIn('- Fruit (active)', content) self.assertNotIn(' - Apple (active)', content) self.assertIn(' - Banana (active)', content) def test_top_context(self): content = render_to_string('navtag_tests/context/home.txt').strip() self.assertIn('- Home (active)', content) self.assertIn('HOME', content) def test_repr(self): node = NavNode() self.assertEqual(repr(node), "