Commits

Marc DM  committed 89daaed

updated javascript to use data attributes on div.nivoSlider for slider initiation. updated image-title update mechanism to use jquery and regular expressions. id attributes for images within the slider have been updated to include {{ object.pk }} so we don't have id clashes on pages with multiple sliders that use the same images

  • Participants
  • Parent commits 428fd7d

Comments (0)

Files changed (1)

File cmsplugin_nivoslider/templates/nivo/slider.html

 
 
 {% addtoblock "css" %}
-    <link rel="stylesheet" href="{{STATIC_URL}}nivo/nivo-slider.css" type="text/css" media="screen" />
+    <link rel="stylesheet" href="{{ STATIC_URL }}nivo/nivo-slider.css" type="text/css" media="screen" />
 {% endaddtoblock %}
 
 {% addtoblock "css" %}
-    <link rel="stylesheet" href="{{STATIC_URL}}nivo/themes/{{object.theme}}/{{object.theme}}.css" type="text/css" media="screen" />
+    <link rel="stylesheet" href="{{ STATIC_URL }}nivo/themes/{{object.theme}}/{{object.theme}}.css" type="text/css" media="screen" />
 {% endaddtoblock %}
+
 {% addtoblock "js" %}
-<script type="text/javascript" src="{{STATIC_URL}}nivo/js/jquery.nivo.slider.pack.js"></script>
+<script type="text/javascript" src="{{ STATIC_URL }}nivo/js/jquery.nivo.slider.pack.js"></script>
 <script type="text/javascript">
 //<![CDATA[
 (function($){
 </script>
 {% endaddtoblock %}
 
-<div    class="slider-wrapper theme-{{object.theme}}"
+<div    class="slider-wrapper theme-{{ object.theme }}"
         {% if object.width %}
-            style="width: {{object.width}}px;"
+            style="width: {{ object.width }}px;"
         {% endif %}>
-    {% spaceless %}<div    id="nivoslider{{object.pk}}" class="nivoSlider"
-            title="{{object.title|default:''}}"
+    <div    id="nivoslider{{ object.pk }}" class="nivoSlider"
+            title="{{ object.title|default:'' }}"
             {% if object.height %}
-                style="height: {{object.height}}px;"
+                style="height: {{ object.height }}px;"
             {% endif %} 
-            data-effect="{{object.effect}}" 
-            data-speed="{{object.anim_speed}}"
-            data-pause_time="{{object.pause_time}}"
-            data-arrows="{{object.arrows|yesno:'1,0'}}"
-            data-thumbs="{{object.thumbnails|yesno:'1,0'}}" 
-            data-pause_on_hover="{{object.pause_on_hover|yesno:'1,0'}}"
-            data-manual="{{object.manual_advance|yesno:'1,0'}}"
-            data-randomstart="{{object.random_start|yesno:'1,0'}}">{% endspaceless %}
+            data-effect="{{ object.effect }}" 
+            data-speed="{{ object.anim_speed }}"
+            data-pause_time="{{ object.pause_time }}"
+            data-arrows="{{ object.arrows|yesno:'1,0' }}"
+            data-thumbs="{{ object.thumbnails|yesno:'1,0' }}" 
+            data-pause_on_hover="{{ object.pause_on_hover|yesno:'1,0' }}"
+            data-manual="{{ object.manual_advance|yesno:'1,0' }}"
+            data-randomstart="{{ object.random_start|yesno:'1,0' }}">
         {% for img in images %}{% spaceless %}
             <img    id="nivo-slide{{object.pk}}_{{img.pk}}-image"
                     src="{% if object.size %}{% thumbnail img.image object.size crop upscale %}{% else %}{{ img.image.url }}{% endif %}"
                     data-thumb="{{ img.image.icons.64 }}"
                     alt="{{img.name|default:''}}" />
             
-                <div id="nivo-slide{{object.pk}}_{{img.pk}}-text">
-                    {{img.description|default:''|safe}}
+                <div id="nivo-slide{{ object.pk }}_{{ img.pk }}-text">
+                    {{ img.description|default:''|safe }}
                 </div>
             {% endspaceless %}
         {% endfor %}