Skip to content
Permalink
Browse files

Plugin added.

  • Loading branch information...
Raphael Jasjukaitis
Raphael Jasjukaitis committed Jul 31, 2011
1 parent 9a87d8d commit 7aa89b58d99eade4c1b9284959b00b467876e497
No changes.
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-

from django.utils.translation import ugettext as _

from cms.models.pagemodel import Page
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool

class HtmlSitemapPlugin(CMSPluginBase):
name = _('HTML Sitemap')
render_template = 'cmsplugin_htmlsitemap/sitemap.html'

def render(self, context, instance, placeholder):
pages = Page.tree.filter(published=True)
context.update(
{'instance': instance,
'pages': pages
}
)
return context

plugin_pool.register_plugin(HtmlSitemapPlugin)
@@ -0,0 +1 @@
Foo
@@ -0,0 +1,17 @@
{% load mptt_tags %}
<div id="sitemap">
{% for page, structure in pages|tree_info %}
{% if structure.new_level %}
<ul>
<li>
{% else %}
</li>
<li>
{% endif %}
<a href="{{ page.get_absolute_url }}" title="{{ page }}">{{ page }}</a>
{% for level in structure.closed_levels %}
</li>
</ul>
{% endfor %}
{% endfor %}
</div>

0 comments on commit 7aa89b5

Please sign in to comment.
You can’t perform that action at this time.