You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.0 KiB
68 lines
2.0 KiB
#-*- coding: utf -8-*-
|
|
from cms.plugin_base import CMSPluginBase
|
|
from cms.plugin_pool import plugin_pool
|
|
from models import IndexBlockPlugin, ExtendedTextBlockPlugin, ExtendedBlockPlugin
|
|
from forms import IndexBlockForm, ExtendedBlockForm
|
|
from django.utils.translation import ugettext as _
|
|
|
|
|
|
class CMSIndexBlockPlugin(CMSPluginBase):
|
|
model = IndexBlockPlugin
|
|
form = IndexBlockForm
|
|
name = u'Блок на главной (картинка и текст)'
|
|
render_template = "index_block.html"
|
|
|
|
def render(self, context, instance, placeholder):
|
|
context.update({
|
|
'object':instance,
|
|
'placeholder':placeholder
|
|
})
|
|
return context
|
|
|
|
|
|
class CMSExtendedTextBlockPlugin(CMSPluginBase):
|
|
model = ExtendedTextBlockPlugin
|
|
form = ExtendedBlockForm
|
|
name = u'Раскрывающийся блок'
|
|
render_template = "extended_text_block.html"
|
|
|
|
def render(self, context, instance, placeholder):
|
|
context.update({
|
|
'object':instance,
|
|
'placeholder':placeholder
|
|
})
|
|
return context
|
|
|
|
|
|
class CMSExtendedBlockPlugin(CMSPluginBase):
|
|
model = ExtendedBlockPlugin
|
|
form = ExtendedBlockForm
|
|
name = u'Раскрывающийся блок с картинкой'
|
|
render_template = "extended_block.html"
|
|
|
|
def render(self, context, instance, placeholder):
|
|
context.update({
|
|
'object':instance,
|
|
'placeholder':placeholder
|
|
})
|
|
return context
|
|
|
|
|
|
class CMSSlideshowBlockPlugin(CMSPluginBase):
|
|
model = IndexBlockPlugin
|
|
form = IndexBlockForm
|
|
name = u'Кадр слайдшоу'
|
|
render_template = "slideshow_block.html"
|
|
|
|
def render(self, context, instance, placeholder):
|
|
context.update({
|
|
'object':instance,
|
|
'placeholder':placeholder
|
|
})
|
|
return context
|
|
|
|
|
|
plugin_pool.register_plugin(CMSExtendedTextBlockPlugin)
|
|
# plugin_pool.register_plugin(CMSIndexBlockPlugin)
|
|
plugin_pool.register_plugin(CMSExtendedBlockPlugin)
|
|
# plugin_pool.register_plugin(CMSSlideshowBlockPlugin)
|
|
|