This repository has been archived by the owner on Jan 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- app it self added - meta info like MANIFEST, CHANGELOG, README, setup.py etc added - aldryn integration "addon.json" file added
- Loading branch information
0 parents
commit 2eb3ba5
Showing
22 changed files
with
347 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
2014-04-26 Jakub Janoszek <[email protected]> | ||
|
||
* Initial package setup: package it self, manifest, readme and | ||
"addon.json" files added |
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,24 @@ | ||
Copyright (c) 2014, Divio AG | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
* Neither the name of Divio AG nor the | ||
names of its contributors may be used to endorse or promote products | ||
derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL DIVIO AG BE LIABLE FOR ANY | ||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,3 @@ | ||
include README.rst | ||
include CHANGELOG | ||
recursive-include accordion/templates * |
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,4 @@ | ||
aldryn accordion | ||
================ | ||
|
||
Plugin allows to define accordion, each item might have another items. |
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 @@ | ||
__version__ = '0.0.1' |
Binary file not shown.
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,78 @@ | ||
# -*- coding: utf-8 -*- | ||
import json | ||
|
||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
from cms.plugin_pool import plugin_pool | ||
from cms.plugin_base import CMSPluginBase | ||
|
||
from aldryn_accordion.models import Accordion, AccordionItem | ||
from aldryn_accordion.forms import AccordionPluginForm | ||
|
||
|
||
class AccordionPlugin(CMSPluginBase): | ||
model = Accordion | ||
name = _('Accordion') | ||
module = _('Accordion') | ||
render_template = 'aldryn_accordion/accordion.html' | ||
allow_children = True | ||
child_classes = ['AccordionItemPlugin'] | ||
form = AccordionPluginForm | ||
|
||
fieldsets = [ | ||
# (None, { | ||
# 'fields': [], | ||
# }), | ||
(_('Advanced options'), { | ||
'classes': ('collapse', ), | ||
'fields': [ | ||
'custom_classes', | ||
'index', | ||
'grouping', | ||
], | ||
}) | ||
] | ||
|
||
def render(self, context, instance, placeholder): | ||
context.update({ | ||
'accordion': instance, | ||
'accordion_id': "plugin-accordion-%s" % instance.pk, | ||
'placeholder': placeholder, | ||
'accordion_json_options': json.dumps({ | ||
'index': instance.index, | ||
'grouping': instance.grouping, | ||
}), | ||
}) | ||
return context | ||
|
||
|
||
class AccordionItemPlugin(CMSPluginBase): | ||
model = AccordionItem | ||
name = _('Accordion item') | ||
module = _('Accordion') | ||
render_template = 'aldryn_accordion/accordion_item.html' | ||
allow_children = True | ||
fieldsets = [ | ||
(None, { | ||
'fields': [ | ||
'title', | ||
], | ||
}), | ||
(_('Advanced options'), { | ||
'classes': ('collapse', ), | ||
'fields': [ | ||
'custom_classes', | ||
], | ||
}) | ||
] | ||
|
||
def render(self, context, instance, placeholder): | ||
context.update({ | ||
'item': instance, | ||
'placeholder': placeholder, | ||
}) | ||
return context | ||
|
||
|
||
plugin_pool.register_plugin(AccordionPlugin) | ||
plugin_pool.register_plugin(AccordionItemPlugin) |
Binary file not shown.
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,7 @@ | ||
from django import forms | ||
from aldryn_accordion.models import Accordion | ||
|
||
class AccordionPluginForm(forms.ModelForm): | ||
class Meta: | ||
model = Accordion | ||
exclude = ('page', 'position', 'placeholder', 'language', 'plugin_type') |
Binary file not shown.
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,20 @@ | ||
# -*- coding: utf-8 -*- | ||
import datetime | ||
from south.db import db | ||
from south.v2 import SchemaMigration | ||
from django.db import models | ||
|
||
|
||
class Migration(SchemaMigration): | ||
|
||
def forwards(self, orm): | ||
pass | ||
|
||
def backwards(self, orm): | ||
pass | ||
|
||
models = { | ||
|
||
} | ||
|
||
complete_apps = ['aldryn_accordion'] |
Binary file not shown.
74 changes: 74 additions & 0 deletions
74
accordion/migrations/0002_auto__add_accordionitem__add_accordion.py
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,74 @@ | ||
# -*- coding: utf-8 -*- | ||
import datetime | ||
from south.db import db | ||
from south.v2 import SchemaMigration | ||
from django.db import models | ||
|
||
|
||
class Migration(SchemaMigration): | ||
|
||
def forwards(self, orm): | ||
# Adding model 'AccordionItem' | ||
db.create_table(u'cmsplugin_accordionitem', ( | ||
(u'cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)), | ||
('title', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)), | ||
('custom_classes', self.gf('django.db.models.fields.CharField')(max_length=200, blank=True)), | ||
)) | ||
db.send_create_signal(u'aldryn_accordion', ['AccordionItem']) | ||
|
||
# Adding model 'Accordion' | ||
db.create_table(u'cmsplugin_accordion', ( | ||
(u'cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)), | ||
('custom_classes', self.gf('django.db.models.fields.CharField')(max_length=200, blank=True)), | ||
('index', self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True)), | ||
('grouping', self.gf('django.db.models.fields.BooleanField')(default=True)), | ||
)) | ||
db.send_create_signal(u'aldryn_accordion', ['Accordion']) | ||
|
||
|
||
def backwards(self, orm): | ||
# Deleting model 'AccordionItem' | ||
db.delete_table(u'cmsplugin_accordionitem') | ||
|
||
# Deleting model 'Accordion' | ||
db.delete_table(u'cmsplugin_accordion') | ||
|
||
|
||
models = { | ||
u'aldryn_accordion.accordion': { | ||
'Meta': {'object_name': 'Accordion', 'db_table': "u'cmsplugin_accordion'", '_ormbases': ['cms.CMSPlugin']}, | ||
u'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), | ||
'custom_classes': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}), | ||
'grouping': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), | ||
'index': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}) | ||
}, | ||
u'aldryn_accordion.accordionitem': { | ||
'Meta': {'object_name': 'AccordionItem', 'db_table': "u'cmsplugin_accordionitem'", '_ormbases': ['cms.CMSPlugin']}, | ||
u'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), | ||
'custom_classes': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}), | ||
'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True'}) | ||
}, | ||
'cms.cmsplugin': { | ||
'Meta': {'object_name': 'CMSPlugin'}, | ||
'changed_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), | ||
'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'language': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}), | ||
'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), | ||
'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), | ||
'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.CMSPlugin']", 'null': 'True', 'blank': 'True'}), | ||
'placeholder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}), | ||
'plugin_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), | ||
'position': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}), | ||
'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), | ||
'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}) | ||
}, | ||
'cms.placeholder': { | ||
'Meta': {'object_name': 'Placeholder'}, | ||
'default_width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'slot': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}) | ||
} | ||
} | ||
|
||
complete_apps = ['aldryn_accordion'] |
Binary file not shown.
Empty file.
Binary file not shown.
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,25 @@ | ||
from django.db import models | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
from cms.models import CMSPlugin | ||
|
||
|
||
class Accordion(CMSPlugin): | ||
custom_classes = models.CharField(_('custom classes'), max_length=200, blank=True) | ||
index = models.PositiveIntegerField(_('index'), null=True, blank=True, | ||
help_text=_('index of element that should be opened on page load ' | ||
'(leave it empty if none of itemes should be opened), zero is the first item')) | ||
grouping = models.BooleanField(_('grouping'), default=True, | ||
help_text=_('only one can be opened at a time (true) or every ' | ||
'entry can be opened individually (false)')) | ||
|
||
def __unicode__(self): | ||
return _(u"%s items") % self.cmsplugin_set.all().count() | ||
|
||
|
||
class AccordionItem(CMSPlugin): | ||
title = models.CharField(_('title'), max_length=255, null=True) | ||
custom_classes = models.CharField(_('custom classes'), max_length=200, blank=True) | ||
|
||
def __unicode__(self): | ||
return u"%s" % self.title |
Binary file not shown.
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,36 @@ | ||
{% load i18n static sekizai_tags cms_tags %} | ||
|
||
<div class="plugin plugin-accordion {% if accordion.custom_classes %} {{ accordion.custom_classes }} {% endif %}" id="{{ accordion_id }}"> | ||
{% for plugin in accordion.child_plugin_instances %} | ||
{% with parentloop=forloop %}{% render_plugin plugin %}{% endwith %} | ||
{% endfor %} | ||
</div> | ||
|
||
{% addtoblock "js" %}<script src="{% static "js/plugins/cl.accordion.min.js" %}"></script>{% endaddtoblock %} | ||
{% addtoblock "js" %} | ||
<script> | ||
jQuery(document).ready(function ($) { | ||
{% comment %} | ||
"index" and "grouping" are profided in "accordion_json_options" | ||
- "index": setting for setting the initial opened accordion, null for none | ||
- "grouping": defines if only one can be opened at a time or every entry can be opened individually | ||
{% endcomment %} | ||
var options = $.extend({ | ||
// settings | ||
'index': null, | ||
'grouping': true, | ||
// leave this static | ||
'forceClose': true, | ||
'cls': { | ||
'trigger': '.accordion-trigger', | ||
'container': '.accordion-container' | ||
}, | ||
'lang': { | ||
'expanded': '{% trans "Close" %} ', | ||
'collapsed': '{% trans "Open" %} ' | ||
} | ||
}, {{ accordion_json_options|safe }}); | ||
new Cl.Accordion("#{{ accordion_id }}", options); | ||
}); | ||
</script> | ||
{% endaddtoblock %} |
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,13 @@ | ||
{% load cms_tags i18n %} | ||
|
||
<div class="accordion-trigger"> | ||
{{ item.title }} <span class="text">{% trans "Close" %}</span> | ||
</div> | ||
|
||
<div class="accordion-container"> | ||
<div class="accordion-item {% if item.custom_classes %} {{ item.custom_classes }}{% endif %}{% if parentloop.first %} alpha{% endif %}{% if parentloop.last %} omega{% endif %}"> | ||
{% for plugin in item.child_plugin_instances %} | ||
{% render_plugin plugin %} | ||
{% endfor %} | ||
</div> | ||
</div> |
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,15 @@ | ||
{ | ||
"name": "Accordion", | ||
"description": "Allows", | ||
"version": "0.0.1", | ||
"url": "https://github.com/aldryn/aldryn-accordion", | ||
"package-name": "aldryn-accordion", | ||
"installed-apps": [], | ||
"author": { | ||
"name": "Divio AG", | ||
"url": "https://www.divio.ch" | ||
}, | ||
"license": { | ||
"name": "BSD", | ||
} | ||
} |
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,43 @@ | ||
# -*- coding: utf-8 -*- | ||
import re | ||
from setuptools import setup, find_packages | ||
|
||
|
||
version = re.search( | ||
r"__version__ = ['\"](.*)['\"]", | ||
open("accordion/__init__.py").read() | ||
).group(1) | ||
|
||
|
||
REQUIREMENTS = [] | ||
|
||
|
||
CLASSIFIERS = [ | ||
'Development Status :: 4 - Beta', | ||
'Environment :: Web Environment', | ||
'Framework :: Django', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: BSD License', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Topic :: Internet :: WWW/HTTP :: Dynamic Content', | ||
'Topic :: Software Development', | ||
'Topic :: Software Development :: Libraries :: Application Frameworks', | ||
] | ||
|
||
|
||
setup( | ||
name='aldryn-accordion', | ||
version=version, | ||
description='Create accordion structure and put plugins of your choice in it.', | ||
author='Divio AG', | ||
author_email='[email protected]', | ||
url='https://github.com/aldryn/aldryn-accordion', | ||
packages=find_packages(), | ||
license='LICENSE.txt', | ||
platforms=['OS Independent'], | ||
install_requires=REQUIREMENTS, | ||
classifiers=CLASSIFIERS, | ||
include_package_data=True, | ||
zip_safe=False | ||
) |