<commit_before>{% extends "makeaface/base.html" %}
{% load abs %}

{% block htmlhead %}
{% endblock %}

{% block content %}
    <div id="gridcontainer">
        <div id="photobox">
            <div id="photo">
                <img src="{{ photo.links.maxwidth__500.href }}">
            </div>
        </div>

        <div id="photo-data">
            <div id="photo-data-inner">
            <div id="photo-by">
                <p><big>
                    <a href="{{ photo.author.typepad_url }}"><img src="{{ photo.author.links.rel__avatar.maxwidth__50.href }}"></a>
                    <a href="{{ photo.author.typepad_url }}">{{ photo.author.display_name }}</a>'s face
                </big></p>
            </div>

            <div>
                <p>
                    <span class="tp-button">
                        <span class="button button-heart button-xl">
                            <a id="photo-action-heart" href="{{ photo.xid }}"><span class="heart">♥</span><span class="text">I like this face</span></a>
                        </span>
                    </span>
                </p>
            </div>

            {% if favorites %}
            <div id="photo-favorites">
                <h2>Facers who liked this face</h2>

                {% for fav in favorites %}
                    <div class="favorite">
                        <big>
                            <a href="{{ fav.author.typepad_url }}"><img src="{{ fav.author.links.rel__avatar.maxwidth__50.href }}"></a>
                            <a href="{{ fav.author.typepad_url }}">{{ fav.author.display_name }}</a>
                        </big>
                    </div>
                {% endfor %}
            </div>
            {% endif %}

            <div class="photo-action-flag">
                <p>
                    <span class="tp-button">
                        <span class="button button-flag">
                            <a id="photo-action-flag" href="{{ photo.xid }}"><span class="flag">⚑</span><span class="text">This is not a face</span></a>
                        </span>
                    </span>
                </p>
            </div>

            <script type="text/javascript">
            $('#photo-action-heart').click(function (evt) {
                var heart = $(this);
                $.post('{% absoluteurl %}{% url favorite %}{% endabsoluteurl %}', {
                    'action': 'favorite',
                    'asset_id': heart.attr('href')
                }, function () {
                    heart.addClass('favorited');
                    heart.find('.text').text('You like this face!');
                });
                heart.blur();
                return false;
            });

            $('#photo-action-flag').click(function (evt) {
                var flag = $(this);
                $.post('{% absoluteurl %}{% url flag %}{% endabsoluteurl %}', {
                    'action': 'flag',
                    'asset_id': flag.attr('href')
                }, function () {
                    flag.addClass('flagged');
                    flag.find('.text').text('Flagged!');
                });
                flag.blur();
                return false;
            });
            </script>

            </div>
        </div>
    </div>

{% endblock %}
<commit_msg>Only show photo actions to signed-in users<commit_after>{% extends "makeaface/base.html" %}
{% load abs %}

{% block htmlhead %}
{% endblock %}

{% block content %}
    <div id="gridcontainer">
        <div id="photobox">
            <div id="photo">
                <img src="{{ photo.links.maxwidth__500.href }}">
            </div>
        </div>

        <div id="photo-data">
            <div id="photo-data-inner">
            <div id="photo-by">
                <p><big>
                    <a href="{{ photo.author.typepad_url }}"><img src="{{ photo.author.links.rel__avatar.maxwidth__50.href }}"></a>
                    <a href="{{ photo.author.typepad_url }}">{{ photo.author.display_name }}</a>'s face
                </big></p>
            </div>

            {% if user.is_authenticated %}
            <div>
                <p>
                    <span class="tp-button">
                        <span class="button button-heart button-xl">
                            <a id="photo-action-heart" href="{{ photo.xid }}"><span class="heart">♥</span><span class="text">I like this face</span></a>
                        </span>
                    </span>
                </p>
            </div>
            {% endif %}

            {% if favorites %}
            <div id="photo-favorites">
                <h2>Facers who liked this face</h2>

                {% for fav in favorites %}
                    <div class="favorite">
                        <big>
                            <a href="{{ fav.author.typepad_url }}"><img src="{{ fav.author.links.rel__avatar.maxwidth__50.href }}"></a>
                            <a href="{{ fav.author.typepad_url }}">{{ fav.author.display_name }}</a>
                        </big>
                    </div>
                {% endfor %}
            </div>
            {% endif %}

            {% if user.is_authenticated %}
            <div class="photo-action-flag">
                <p>
                    <span class="tp-button">
                        <span class="button button-flag">
                            <a id="photo-action-flag" href="{{ photo.xid }}"><span class="flag">⚑</span><span class="text">This is not a face</span></a>
                        </span>
                    </span>
                </p>
            </div>
            {% endif %}

            <script type="text/javascript">
            $('#photo-action-heart').click(function (evt) {
                var heart = $(this);
                $.post('{% absoluteurl %}{% url favorite %}{% endabsoluteurl %}', {
                    'action': 'favorite',
                    'asset_id': heart.attr('href')
                }, function () {
                    heart.addClass('favorited');
                    heart.find('.text').text('You like this face!');
                });
                heart.blur();
                return false;
            });

            $('#photo-action-flag').click(function (evt) {
                var flag = $(this);
                $.post('{% absoluteurl %}{% url flag %}{% endabsoluteurl %}', {
                    'action': 'flag',
                    'asset_id': flag.attr('href')
                }, function () {
                    flag.addClass('flagged');
                    flag.find('.text').text('Flagged!');
                });
                flag.blur();
                return false;
            });
            </script>

            </div>
        </div>
    </div>

{% endblock %}

{'fraction_non_alphanumeric': 0.16733008993070914, 'fraction_numerical': 0.0026536930561698365, 'mean_word_length': 1.1646458200382896, 'pattern_counts': {'":': 0, '<': 133, '<?xml version=': 0, '>': 133, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2884883', 'n_tokens_mistral': 1897, 'n_tokens_neox': 1730, 'n_words': 354}