-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Raphael Jasjukaitis
committed
Jul 31, 2011
1 parent
9a87d8d
commit 7aa89b5
Showing
4 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
1 change: 1 addition & 0 deletions
1
cmsplugin_htmlsitemap/templates/cmsplugin_htmlsitemap/sitemap.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
Foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |