Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved plugin processors to a seperate file
Changed the PluginRender class to a function since the class was pointless Using django-load (copied to cms/utils/django_load.py because it's only a single file) for loading of apphooks, plugins, menus and plugin processors to remove boilerplate code
- Loading branch information
Jonas Obrist
committed
Mar 4, 2011
1 parent
668fc0e
commit 5a595fb
Showing
9 changed files
with
159 additions
and
123 deletions.
There are no files selected for viewing
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
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
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
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
from django.utils.safestring import mark_safe | ||
|
||
def plugin_meta_context_processor(instance, placeholder): | ||
return { | ||
'plugin_index': instance._render_meta.index, # deprecated template variable | ||
'plugin': { | ||
'counter': instance._render_meta.index + 1, | ||
'counter0': instance._render_meta.index, | ||
'revcounter': instance._render_meta.total - instance._render_meta.index, | ||
'revcounter0': instance._render_meta.total - instance._render_meta.index - 1, | ||
'first': instance._render_meta.index == 0, | ||
'last': instance._render_meta.index == instance._render_meta.total - 1, | ||
'total': instance._render_meta.total, | ||
'id_attr': 'plugin_%i_%i' % (instance.placeholder.pk, instance.pk), | ||
'instance': instance, | ||
} | ||
} | ||
|
||
def mark_safe_plugin_processor(instance, placeholder, rendered_content, original_context): | ||
return mark_safe(rendered_content) |
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
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
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
Oops, something went wrong.