Commits

anshik  committed 106f5b3

now it works for me

  • Participants
  • Parent commits 8a9393e

Comments (0)

Files changed (3)

File cmsplugin_colorbox/cms_plugins.py

 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
-from cmsplugin_filer_gallery.models import ANIMATION_CHOICES
+from cmsplugin_colorbox.models import FilerGalleryColorBox
+
 
 class FilerGalleryColorBoxPlugin(CMSPluginBase):
-    model = FilerGallery
+    model = FilerGalleryColorBox
     name = _("Filer Gallery ColorBox")
     render_template = "cmsplugin_colorbox/gallery.html"
     text_enabled = False
     admin_preview = False
     
     def render(self, context, instance, placeholder):
-#        active_gallery = FilerGallery.objects.get(pk = instance)
-#        config = simplejson.dumps({
-#            'navigation': True,
-#            'interval': 2500,
-#            'numbers': True,
-#            'label': True,
-#            'animation':ANIMATION_CHOICES[active_gallery.animation][1],
-#            'thumbs': False,
-#            'hideTools': False,
-#            'dots': False,
-#            'easing_default': None,
-#            'velocity': 1,
-#            'animateNumberOut': {'backgroundColor':'#000', 'color':'#ccc'},
-#            'animateNumberOver': {'backgroundColor':'#000', 'color':'#ccc'},
-#            #'animateNumberActive': {'backgroundColor':'#000', 'color':'#ccc'},
-#            'animateNumberActive': {'backgroundColor':'#000', 'color':active_gallery.animateNumberActive},
-#            'width_label': None,
-#            'show_randomly': False
-#            }
-#        )
-#        context.update({
-#            'instance': instance,
-#            'size': (instance.width, instance.height),
-#            'thumb_size': (instance.thumb_height, instance.thumb_width),
-#            'skitter_config': config
-#        })
+        active_gallery = FilerGalleryColorBox.objects.get(pk = instance)
+        print dir(instance.gallery.galleryimage_set.all()[0])
+        print instance.gallery.galleryimage_set.all()[0].image
+        context.update({
+            'instance': instance,
+            'size': (instance.width, instance.height),
+            'thumb_size': (instance.thumb_height, instance.thumb_width),
+
+        })
         return context
 
 plugin_pool.register_plugin(FilerGalleryColorBoxPlugin)

File cmsplugin_colorbox/models.py

 from django.db import models
 from cms.models import CMSPlugin, Page
 
-ANIMATION_CHOICES=('fade', 'horizontal-slide', 'vertical-slide', 'horizontal-push')
-ANIMATION_CHOICES=tuple(enumerate(ANIMATION_CHOICES))
-CAPTION_ANIMATION_CHOICES=('fade', 'slideOpen')
-CAPTION_ANIMATION_CHOICES=tuple(enumerate(CAPTION_ANIMATION_CHOICES))
-
-class FilerGallery(CMSPlugin):
+class FilerGalleryColorBox(CMSPlugin):
 
     gallery = models.ForeignKey('filer_gallery.Gallery')
 
-    animation = models.SmallIntegerField(_("animation"), choices=ANIMATION_CHOICES, default=0)
-    animateNumberActive = models.CharField(_("active number color"), default='#FF0000', max_length=7, help_text=_('Default #FF0000 red'))
-
-
     height = models.SmallIntegerField(_("height"),default=200)
     width = models.SmallIntegerField(_("width"), default=300)
     thumb_height = models.SmallIntegerField(_("thumbnail height"), null=True, blank=True, default=None, help_text=_('Leave empty for no thumbs.'))
     thumb_width = models.SmallIntegerField(_("thumbnail width"),null=True, blank=True, default=None, help_text=_('Leave empty for no thumbs.'))
     
     class Meta:
-        verbose_name = _("django filer gallery")
-        verbose_name_plural = _("django filer galleries")
+        verbose_name = _("django filer gallery ColorBox")
+        verbose_name_plural = _("django filer galleries ColorBox")

File cmsplugin_colorbox/templates/cmsplugin_colorbox/gallery.html

 {% load thumbnail sekizai_tags %}
-{% addtoblock "css" %}<link href="{{ STATIC_URL }}filer_gallery/skitter/css/skitter.styles.css" type="text/css" media="all" rel="stylesheet" />{% endaddtoblock %}
-{% addtoblock "css" %}<link href="{{ STATIC_URL }}filer_gallery/skitter.css" type="text/css" media="all" rel="stylesheet" />{% endaddtoblock %}
-{% addtoblock "css" %}<link href="{{ STATIC_URL }}filer_gallery/filer_gallery.css" type="text/css" media="all" rel="stylesheet" />{% endaddtoblock %}
+{% addtoblock "css" %}<link href="{{ STATIC_URL }}colorbox/example1/colorbox.css" type="text/css" media="all" rel="stylesheet" />{% endaddtoblock %}
 
 {% addtoblock "js" %}<script src="{{ STATIC_URL }}filer_gallery/skitter/js/jquery-1.6.3.min.js"></script>{% endaddtoblock %}
-{% addtoblock "js" %}<script src="{{ STATIC_URL }}filer_gallery/skitter/js/jquery.easing.1.3.js"></script>{% endaddtoblock %}
-{% addtoblock "js" %}<script src="{{ STATIC_URL }}filer_gallery/skitter/js/jquery.animate-colors-min.js"></script>{% endaddtoblock %}
-
-{% addtoblock "js" %}<script src="{{ STATIC_URL }}filer_gallery/skitter/js/jquery.skitter.js"></script>{% endaddtoblock %}
-{% addtoblock "js" %}<script src="{{ STATIC_URL }}filer_gallery/skitter_init.js"></script>{% endaddtoblock %}
-
-
+{% addtoblock "js" %}<script src="{{ STATIC_URL }}colorbox/colorbox/jquery.colorbox.js"></script>{% endaddtoblock %}
 {% addtoblock "js" %}
-<script type="text/javascript">
-//<![CDATA[
-(function ($) {
-    var config = {{ skitter_config|safe }}
-    $(document).ready(function () {
-       $('#filer-gallery-plugin-{{ instance.pk }}').skitter(config);
-       $('#filer-gallerythumbs-plugin-{{ instance.pk }} img:first').addClass('active')
-       $('#filer-gallery-plugin-{{ instance.pk }}').bind("imageSwitched", function(event, skitter, imagenum ) {
-           $('#filer-gallerythumbs-plugin-{{ gallery.pk }} img').removeClass('active')
-           var child = imagenum == 0 ? 'last' : 'nth-child(' + imagenum + ')'
-           $('#filer-gallerythumbs-plugin-{{ gallery.pk }} img:' + child).addClass('active')
-       });
-
-    });
-})(skitter_jQuery)
-//]]>
+<script>
+	$(document).ready(function(){
+		$(".group1").colorbox({rel:'group1', height:"100%"});
+		$("#click").click(function(){
+			$('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
+			return false;
+		});
+	});
 </script>
 {% endaddtoblock %}
 
-<div class="filer-gallery-wrapper border_shadow">
-<div class="filer-gallery-imagewrapper">
-
 <div id="filer-gallery-plugin-{{ instance.pk }}" class="box_skitter box_skitter_medium">
     <ul>
     {% for image in instance.gallery.galleryimage_set.all %}
-        <li>
-            <a href="#"><img src="{% thumbnail image.image size %}" /></a>
-            <div class="label_text">
-                <p>{{ image.title }}</p>
-            </div>
-        </li>
+        <a class="group1" href="{% thumbnail image.image size %}"><img src="{% thumbnail image.image thumb_size %}" /></a>
+        {{ image.path }}
     {% endfor %}
     </ul> 
 </div>
-</div>
-{% if instance.thumb_height %}
-<div id="filer-gallerythumbs-{{ instance.pk }}" class="filer-gallery-thumbswrapper">
-{% spaceless %}
-{% for image in instance.gallery.galleryimage_set.all %}
-<img src="{% thumbnail image.image thumb_size %}" onclick="skitter_jQuery('#filer-gallery-{{ instance.pk }}').skitter('setimage', {{ forloop.counter0 }});return false"/>
-{% endfor %}
-{% endspaceless %}
-</div>
-{% endif %}
-</div>