Skip to content

Commit

Permalink
Plugin added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Jasjukaitis committed Jul 31, 2011
1 parent 9a87d8d commit 7aa89b5
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
Empty file.
22 changes: 22 additions & 0 deletions cmsplugin_htmlsitemap/cms_plugins.py
Original file line number Original file line Diff line number Diff line change
@@ -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)
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
Foo
17 changes: 17 additions & 0 deletions cmsplugin_htmlsitemap/templates/sitemap.html
Original file line number Original file line Diff line number Diff line change
@@ -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.