Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

configuration options

  • Loading branch information...
commit 12b391dc3c44440a016485143a4a95906c9cd5ea 1 parent cbefd91
@fivethreeo authored
View
18 cmsplugin_filer_gallery/cms_plugins.py
@@ -1,4 +1,5 @@
from django.utils.translation import ugettext_lazy as _
+from django.utils import simplejson
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from cmsplugin_filer_gallery.models import FilerGallery
@@ -12,8 +13,23 @@ class FilerGalleryPlugin(CMSPluginBase):
admin_preview = False
def render(self, context, instance, placeholder):
+ config = simplejson.dumps({
+ 'animation': instance.animation.get_display(), # fade, horizontal-slide, vertical-slide, horizontal-push
+ 'animationSpeed': instance.speed, # how fast animations are
+ 'timer': instance.timer, # True or False to have the timer
+ 'advanceSpeed': instance.advanced_speed, # if timer is enabled, time between transitions
+ 'pauseOnHover': instance.pause_on_hover, # if you hover pauses the slider
+ 'startClockOnMouseOut': instance.start_on_mouseout, # if clock should start on MouseOut
+ 'startClockOnMouseOutAfter': instance.start_after, # how long after MouseOut should the timer start again
+ 'directionalNav': instance.directional_nav, # manual advancing directional navs
+ 'captions': instance.captions, # do you want captions?
+ 'captionAnimation': instance.caption_animation.get_display(), # fade, slideOpen, none
+ 'captionAnimationSpeed': instance.caption_speed, # if so how quickly should they animate in
+ 'bullets': instance.bullets # True or False to activate the bullet navigation
+ })
context.update({
- 'instance': instance
+ 'instance': instance,
+ 'orbit_config': config
})
return context
View
21 cmsplugin_filer_gallery/models.py
@@ -3,10 +3,27 @@
from django.db import models
from cms.models import CMSPlugin, Page
+ANIMATION_CHOICES=('fade', 'horizontal-slide', 'vertical-slide', 'horizontal-push')
+ANIMATION_CHOICES=dict(enumerate(ANIMATION_CHOICES))
+
class FilerGallery(CMSPlugin):
gallery = models.ForeignKey('filer_gallery.Gallery')
-
+ height = models.SmallIntegerField(default=200)
+ width = models.SmallIntegerField(default=300)
+ animation = models.SmallIntegerField(choices=ANIMATION_CHOICES)
+ speed = models.SmallIntegerField(default=600)
+ timer = models.BooleanField(default=True)
+ advanced_speed = models.IntegerField(default=4000)
+ pause_on_hover = models.BooleanField(default=True)
+ start_on_mouseout = models.BooleanField(default=True)
+ start_after = models.IntegerField(default=1000)
+ directional_nav = models.BooleanField(default=False)
+ captions = models.BooleanField(default=False)
+ caption_animation = models.SmallIntegerField(choices=ANIMATION_CHOICES)
+ caption_speed = models.SmallIntegerField(default=800)
+ bullets = models.BooleanField(default=False)
+
class Meta:
verbose_name = _("django filer gallery")
- verbose_name_plural = _("django filer galleries")
+ verbose_name_plural = _("django filer galleries")
View
5 cmsplugin_filer_gallery/templates/cmsplugin_filer_gallery/gallery.html
@@ -7,8 +7,9 @@
<script type="text/javascript">
//<![CDATA[
(function ($) {
+ var config = {{ orbit_config }}
$(document).ready(function () {
- $('#filer-gallery-{{ instance.pk }}').orbit();
+ $('#filer-gallery-{{ instance.pk }}').orbit(config);
});
})(jQuery)
//]]>
@@ -17,6 +18,6 @@
<div id="filer-gallery-{{ instance.pk }}">
{% for image in instance.gallery.galleryimage_set.all %}
- <img src="{% thumbnail image.image 300x200 %}" alt="{{ image.title }}" />
+ <img src="{% thumbnail image.image size %}" alt="{{ image.title }}" />
{% endfor %}
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.