hovel / imagestore

Django gallery solution.
BSD 3-Clause "New" or "Revised" License
164 stars 72 forks source link

Django CMS Template imagestore_album.html and prettyPhoto #36

Open ghost opened 10 years ago

ghost commented 10 years ago

Hi, i would like to use the imagestore app inside my small django cms project. After executing the tutorial i get really fast a good result. The only problem i run into is that the javascript snippet inside the template imagestore_album.html throughs an error. It's not able to find the CMS object (unresolved reference).

So i take a look at your application and found a solution for me by modify the template. The difference is the usage of sekizai and the django cms predefined block tags.

{% load thumbnail %}
{% load sekizai_tags %}
{% load staticfiles %}

{% addtoblock "css" %}
<link rel="stylesheet" href={% static "css/prettyPhoto.css" %} type="text/css" media="screen" title="prettyPhoto main stylesheet" charset="utf-8" />
{% endaddtoblock %}

<div id='gallery'>
    {% for image in album.images.all %}
        {% thumbnail image.image "120x120" crop="center" as im %}
            {% thumbnail image.image "600x600" as full %}
                <a rel='gallery[pp_gal]' href="{{ full.url }}">
                        <img class="preview" {% if image.title %} alt="{{ image.title }}" {% endif %} src="{{ im.url }}">
                </a>
            {% endthumbnail %}
        {% endthumbnail %}
    {% endfor %}

    {% addtoblock "js" %}
    <script type="application/javascript" src={% static "js/jquery.prettyPhoto.js" %}></script>
    <script type="text/javascript" charset="utf-8">
    CMS.$(function() {
        $("a[rel^='gallery']").prettyPhoto({
            allow_resize: true,
            changepicturecallback: function() {
                $(".pp_overlay").css("height", $(document).height());
            }
        });
    });
    </script>
    {% endaddtoblock %}
</div>
GeyseR commented 10 years ago

can you please create pull request from your code?