Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django CMS Template imagestore_album.html and prettyPhoto #36

Open
ghost opened this issue Jun 20, 2014 · 1 comment
Open

Django CMS Template imagestore_album.html and prettyPhoto #36

ghost opened this issue Jun 20, 2014 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 20, 2014

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
Copy link
Contributor

GeyseR commented Jun 20, 2014

can you please create pull request from your code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant