--- a/src/egonomy/__init__.py Thu Jul 04 16:08:50 2013 +0200
+++ b/src/egonomy/__init__.py Thu Jul 04 17:15:33 2013 +0200
@@ -1,4 +1,4 @@
-VERSION = (0, 6, 7, "final", 1)
+VERSION = (0, 6, 8, "final", 1)
VERSION_STR = unicode(".".join(map(lambda i:"%02d" % (i,), VERSION[:2])))
--- a/src/egonomy/templates/egonomy_embed_slideshow.html Thu Jul 04 16:08:50 2013 +0200
+++ b/src/egonomy/templates/egonomy_embed_slideshow.html Thu Jul 04 17:15:33 2013 +0200
@@ -48,36 +48,8 @@
<script type="text/javascript" src="{% static 'egonomy/lib/jquery.min.js' %}"></script>
<script type="text/javascript" src="{% static 'egonomy/js/slideshow.js' %}"></script>
<script>
- {% autoescape off %}
- var imgurlbase = "";
- var slides = [
- {% for item in items %}
- {% ifequal item.content_type.model "fragment" %}
- {% with fragment=item.content_object %}
- {
- "type": "fragment",
- "title": "{{ fragment.title }}",
- "author": "{{ fragment.author }}",
- "src": "{{ fragment.image.info.image_file.url }}",
- "path": "{{ fragment.coordinates }}",
- "description": "{{ item.description|linebreaksantislashn }}"
- }
- {% endwith %}
- {% else %}
- {% with img=item.content_object %}
- {
- "type": "image",
- "title": "{{ img.metadata.titre|default:_('No title') }}",
- "author": "{{ img.metadata.auteur|default:'' }}",
- "src": "{{ img.info.image_file.url }}",
- "description": "{{ item.description|linebreaksantislashn }}"
- }
- {% endwith %}
- {% endifequal %}
- {% if not forloop.last %},{% endif %}
- {% endfor %}
- ];
- {% endautoescape %}
+ var imgurlbase = "";
+ var slides = {{ slides|safe }};
</script>
</body>
</html>
\ No newline at end of file
--- a/src/egonomy/views.py Thu Jul 04 16:08:50 2013 +0200
+++ b/src/egonomy/views.py Thu Jul 04 17:15:33 2013 +0200
@@ -599,8 +599,28 @@
items = CollectionItem.objects.filter(collection=col).select_related('author', 'content_type', 'object_id', 'content_object').order_by("order")
cache_generics(items)
+ slides = []
+ for item in items:
+ if item.content_type.model == "fragment":
+ fragment = item.content_object
+ slides.append({"type":"fragment",
+ "title": fragment.title,
+ "author": str(fragment.author),
+ "src": fragment.image.info.image_file.url,
+ "path": fragment.coordinates,
+ "description": item.description
+ })
+ elif item.content_type.model == "image":
+ image = item.content_object
+ slides.append({"type":"image",
+ "title": image.metadata.titre or _('No title'),
+ "author": image.metadata.auteur or "",
+ "src": image.info.image_file.url,
+ "description": item.description
+ })
+
return render_to_response("egonomy_embed_slideshow.html",
- {'col':col, 'items':items},
+ {'col':col, 'items':items, "slides":json.dumps(slides)},
context_instance=RequestContext(request))