parent
70e9d880d1
commit
f06e38110b
22 changed files with 19 additions and 277 deletions
@ -1,84 +0,0 @@ |
|||||||
#-*- coding: utf -8-*- |
|
||||||
from cms.plugin_base import CMSPluginBase |
|
||||||
from cms.plugin_pool import plugin_pool |
|
||||||
from index_blocks.models import IndexBlockPlugin, ExtendedTextBlockPlugin, ExtendedBlockPlugin, DescTextBlockPlugin |
|
||||||
from index_blocks.forms import IndexBlockForm, ExtendedBlockForm, ExtendedTextBlockForm, DescBlockForm |
|
||||||
from myauth.forms import RegistrationForm |
|
||||||
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 = ExtendedTextBlockForm |
|
||||||
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 CMSDescTextBlockPlugin(CMSPluginBase): |
|
||||||
model = DescTextBlockPlugin |
|
||||||
form = ExtendedBlockForm |
|
||||||
name = u'Заголовок/описание' |
|
||||||
render_template = "desc_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(CMSDescTextBlockPlugin) |
|
||||||
# plugin_pool.register_plugin(CMSSlideshowBlockPlugin) |
|
||||||
@ -1,32 +0,0 @@ |
|||||||
from django.forms.models import ModelForm |
|
||||||
from .models import IndexBlockPlugin, ExtendedTextBlockPlugin, ExtendedBlockPlugin, DescTextBlockPlugin |
|
||||||
from django import forms |
|
||||||
|
|
||||||
|
|
||||||
class IndexBlockForm(ModelForm): |
|
||||||
|
|
||||||
class Meta: |
|
||||||
model = IndexBlockPlugin |
|
||||||
exclude = ('page', 'position', 'placeholder', 'language', 'plugin_type') |
|
||||||
|
|
||||||
|
|
||||||
class ExtendedTextBlockForm(ModelForm): |
|
||||||
|
|
||||||
class Meta: |
|
||||||
model = ExtendedTextBlockPlugin |
|
||||||
exclude = ('page', 'position', 'placeholder', 'language', 'plugin_type') |
|
||||||
|
|
||||||
|
|
||||||
class ExtendedBlockForm(ModelForm): |
|
||||||
|
|
||||||
class Meta: |
|
||||||
model = ExtendedBlockPlugin |
|
||||||
exclude = ('page', 'position', 'placeholder', 'language', 'plugin_type') |
|
||||||
|
|
||||||
|
|
||||||
class DescBlockForm(ModelForm): |
|
||||||
|
|
||||||
class Meta: |
|
||||||
model = ExtendedBlockPlugin |
|
||||||
exclude = ('page', 'position', 'placeholder', 'language', 'plugin_type') |
|
||||||
|
|
||||||
@ -1,28 +0,0 @@ |
|||||||
from django.db import models |
|
||||||
from cms.models.pluginmodel import CMSPlugin |
|
||||||
from djangocms_text_ckeditor.fields import HTMLField |
|
||||||
|
|
||||||
|
|
||||||
class IndexBlockPlugin(CMSPlugin): |
|
||||||
image = models.ImageField(upload_to="uploads/images/") |
|
||||||
title = models.CharField(max_length=100) |
|
||||||
description = models.TextField() |
|
||||||
|
|
||||||
|
|
||||||
class DescTextBlockPlugin(CMSPlugin): |
|
||||||
title = models.CharField(max_length=100) |
|
||||||
description = models.TextField() |
|
||||||
|
|
||||||
|
|
||||||
class ExtendedTextBlockPlugin(CMSPlugin): |
|
||||||
order = models.PositiveIntegerField(default=1) |
|
||||||
title = models.CharField(max_length=100) |
|
||||||
description = HTMLField() |
|
||||||
extended_description = HTMLField() |
|
||||||
|
|
||||||
|
|
||||||
class ExtendedBlockPlugin(CMSPlugin): |
|
||||||
image = models.ImageField(upload_to="uploads/images/") |
|
||||||
title = models.CharField(max_length=100) |
|
||||||
description = models.TextField() |
|
||||||
extended_description = models.TextField() |
|
||||||
@ -1,11 +0,0 @@ |
|||||||
{% load thumbnail %} |
|
||||||
<article class='desc-block'> |
|
||||||
<div class='desc-block-text'> |
|
||||||
<a href="#">{{ object.title }}</a> |
|
||||||
</div> |
|
||||||
<div class='desc-triangle hidden'></div> |
|
||||||
<div class='clear'></div> |
|
||||||
<div class='desc-block-more hidden'> |
|
||||||
{{ object.description|safe }} |
|
||||||
</div> |
|
||||||
</article> |
|
||||||
@ -1,16 +0,0 @@ |
|||||||
{% load thumbnail %} |
|
||||||
<article class='extended-block'> |
|
||||||
<div class='extended-block-img left'> |
|
||||||
{% thumbnail object.image.name "190x132" crop="center" as img %} |
|
||||||
<img src="{{ img.url }}" width="{{ img.width }}" height="{{ img.height }}" {% if picture.alt %}alt="{{ picture.alt }}" {% endif %}{% if picture.longdesc %}title="{{ picture.longdesc }}" {% endif %}/> |
|
||||||
</div> |
|
||||||
<div class='extended-block-text extended-block-toggle'> |
|
||||||
<h3>{{ object.title }}</h3> |
|
||||||
{{ object.description|safe }} |
|
||||||
</div> |
|
||||||
<div class='extended-block-more extended-block-toggle hidden'> |
|
||||||
<h3>{{ object.title }}</h3> |
|
||||||
{{ object.extended_description|safe }} |
|
||||||
</div> |
|
||||||
<div class='clear'></div> |
|
||||||
</article> |
|
||||||
@ -1,17 +0,0 @@ |
|||||||
{% load thumbnail %} |
|
||||||
<article class='extended-block'> |
|
||||||
<div class='extended-block-text'> |
|
||||||
<div class='order left'>{{ object.order }}</div> |
|
||||||
<div class='left text'> |
|
||||||
<h3>{{ object.title }}</h3> |
|
||||||
{{ object.description|safe }} |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class='extended-triangle hidden'></div> |
|
||||||
<div class='clear'></div> |
|
||||||
<div class='extended-block-more hidden'> |
|
||||||
<div class="text"> |
|
||||||
{{ object.extended_description|safe }} |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</article> |
|
||||||
@ -1,12 +0,0 @@ |
|||||||
{% load thumbnail %} |
|
||||||
<article class='index-block left'> |
|
||||||
<div class='index-block-img'> |
|
||||||
{% thumbnail object.image.name "250x110" crop="center" as img %} |
|
||||||
<img src="{{ img.url }}" width="{{ img.width }}" height="{{ img.height }}" {% if picture.alt %}alt="{{ picture.alt }}" {% endif %}{% if picture.longdesc %}title="{{ picture.longdesc }}" {% endif %}/> |
|
||||||
{% endthumbnail %} |
|
||||||
</div> |
|
||||||
<div class='index-block-text'> |
|
||||||
<h3>{{ object.title }}</h3> |
|
||||||
{{ object.description|safe }} |
|
||||||
</div> |
|
||||||
</article> |
|
||||||
@ -1,15 +0,0 @@ |
|||||||
{% load thumbnail %} |
|
||||||
<article class='desc-block'> |
|
||||||
<div class='desc-block-text'> |
|
||||||
<div class='left text'> |
|
||||||
<a href="#">{{ object.title }}</a> |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
<div class='desc-triangle hidden'></div> |
|
||||||
<div class='clear'></div> |
|
||||||
<div class='desc-block-more hidden'> |
|
||||||
<div class="text"> |
|
||||||
{{ object.description|safe }} |
|
||||||
</div> |
|
||||||
</div> |
|
||||||
</article> |
|
||||||
@ -1,10 +0,0 @@ |
|||||||
{% load thumbnail %} |
|
||||||
<li> |
|
||||||
{% thumbnail object.image.name "650x450" crop="center" as img %} |
|
||||||
<img src="{{ img.url }}" width="{{ img.width }}" height="{{ img.height }}" {% if picture.alt %}alt="{{ picture.alt }}" {% endif %}{% if picture.longdesc %}title="{{ picture.longdesc }}" {% endif %}/> |
|
||||||
{% endthumbnail %} |
|
||||||
<div class='index-banner-caption'> |
|
||||||
{% if object.title %}<h1>{{ object.title }}</h1>{% endif %} |
|
||||||
{{ object.description|safe|default:'' }} |
|
||||||
</div> |
|
||||||
</li> |
|
||||||
@ -1,16 +0,0 @@ |
|||||||
""" |
|
||||||
This file demonstrates writing tests using the unittest module. These will pass |
|
||||||
when you run "manage.py test". |
|
||||||
|
|
||||||
Replace this with more appropriate tests for your application. |
|
||||||
""" |
|
||||||
|
|
||||||
from django.test import TestCase |
|
||||||
|
|
||||||
|
|
||||||
class SimpleTest(TestCase): |
|
||||||
def test_basic_addition(self): |
|
||||||
""" |
|
||||||
Tests that 1 + 1 always equals 2. |
|
||||||
""" |
|
||||||
self.assertEqual(1 + 1, 2) |
|
||||||
@ -1 +0,0 @@ |
|||||||
# Create your views here. |
|
||||||
Loading…
Reference in new issue