<commit_before>{% extends 'MaximModuleForumBundle:Default:index.html.twig' %}

{% block title %}Thread - {{ thread.title }}{% endblock title %}

{% block body %}
    <div class="page">
        <h3 class="page-header">{{ thread.title }}<p>Created on {{ thread.createdOn|date('M j \, Y H:i:s') }}</p></h3>
        <div class="page-content">
            {# MAIN TOPIC #}
            <div class="mcsf_thread" id="thread-{{ thread.id }}">

                {# STATUS BAR #}
                <div id="admin-status" class="alert"></div>

                {# BREADCRUMB BAR #}
                <ul class="breadcrumbs">
                    <li><a href="{{ path('forum_view', {'id' : thread.forum.id}) }}">{{ thread.forum.title }}</a></li>
                    <li><a href="{{ path('forum_thread_view', {'id' :  thread.forum.id, 'threadid' : thread.id}) }}" class="active" style="color:gray">{{ thread.title }}</a></li>
                </ul>

                {# ADMIN ACTION BAR #}
                {% if is_granted('ROLE_STAFF') %}
                    <ul class="mcsf_adminbar">
                        <li>
                            <select id="admin_thread_move" data-href="{{ path('forum_thread_move_ajax', {'id' : thread.id}) }}">
                                <option value="0">-- select forum --</option>
                                {% for forum in forums %}
                                    <option value="{{ forum.id }}">{{ forum.category.title }} > {{ forum.title }}</option>
                                {% endfor %}
                            </select>
                        </li>
                        <li><button data-href="{{ path('forum_thread_archive_ajax', {'id' : thread.id}) }}" id="admin_thread_archive">Archive</button></li>
                        <li><button data-href="{{ path('forum_thread_pin_ajax', {'id' : thread.id}) }}" id="admin_thread_pin">{% if thread.isPinned() %}unpin{% else %}pin{% endif %}</button></li>
                        <li><button data-href="{{ path('forum_thread_lock_ajax', {'id' : thread.id}) }}" id="admin_thread_lock">{% if thread.isLocked() %}open{% else %}close{% endif %}</button></li>
                    </ul>
                {% endif %}

                {# HEAD POST #}
                {% if page is not defined %}
                <div class="mcsf_post_main">
                    <div class="mcsf_post row">
                        <div class="mcsf_post_author large-3">
                            <div class="mcsf_post_author_image{% if thread.createdBy.granted(['ROLE_STAFF']) %} mcsf_author_staff{% endif %}">
                                <a href="{{ path('profile', {'name' : thread.createdBy.username}) }}" alt="visit profile of{{ thread.createdBy.username }}">
                                    <img src="{{ asset('/bundles/maximcms/images/blank.gif') }}" data-src="http://minotar.net/avatar/{{ thread.createdBy.username }}/85.png" alt="mc the mass logo" class="preload"/>
                                </a>
                            </div>
                            <div class="mcsf_post_author_info large-8 small-offset-1">

                                <span class="mcsf_post_author_posts">Posts: {{ thread.createdBy.posts|length }}</span>
                                {% if is_granted('ROLE_STAFF') %}
                                    <span class="mcsf_admin_userip">{{ thread.createdBy.lastIp }}</span>
                                {% endif %}
                                <p class="mcsf_post_author_name"><a href="{{ path('profile', {'name' : thread.createdBy.username}) }}" alt="visit profile of{{ thread.createdBy.username }}">{{ thread.createdBy.username }}</a></p>
                                <p class="mcsf_post_author_title {{ thread.createdBy.rank.cssClass }}">{{ thread.createdBy.rank.name }}</p>
                            </div>
                        </div>
                        <div class="mcsf_post_content">
                            <div>
                                {{ thread.text|purify }}

                                {% for update in thread.updates %}
                                    <div class="mcsf_post_update">
                                        <h6>Updated on {{ update.updatedOn|prettydate }}</h6>
                                        <p>{{ update.reason|purify }}</p>
                                    </div>
                                {% endfor %}
                            </div>
                            <div class="mcsf_post_content_lowerbar">
                                {% if is_granted("IS_AUTHENTICATED_REMEMBERED") and thread.createdBy.id == app.user.id %}
                                    <a class="button mcsf_post_option_button" href="{{ path('forum_thread_edit', {'id' : thread.forum.id, 'threadid' : thread.id}) }}">Edit</a>
                                {% endif %}
                                <span class="mcsf_post_createdOn">{{ thread.createdOn|prettydate }}</span>
                            </div>
                            <div style="clear:right;"></div>
                        </div>
                    </div>
                   <div style="clear:both;"></div>
                </div>
                {% endif %}

                {# POSTS #}
                <div class="mcsf_posts">
                    {% for post in posts %}
                    <div class="mcsf_post row">
                        <div class="mcsf_post_author large-3">
                            <div class="mcsf_post_author_image{% if post.createdBy.granted(['ROLE_STAFF']) %} mcsf_author_staff{% endif %}">
                                <a href="{{ path('profile', {'name' : post.createdBy.username}) }}" alt="visit profile of{{ post.createdBy.username }}">
                                    <img src="{{ asset('/bundles/maximcms/images/blank.gif') }}" data-src="http://minotar.net/avatar/{{ post.createdBy.username }}/85.png" alt="mc the mass logo" class="preload"/>
                                </a>
                            </div>
                            <div class="mcsf_post_author_info large-8 small-offset-1">
                                <span class="mcsf_post_author_posts">Posts: {{ post.createdBy.posts|length }}</span>
                                {% if is_granted('ROLE_STAFF') %}
                                    <span class="mcsf_admin_userip">{{ post.createdBy.lastIp }}</span>
                                {% endif %}
                                <p class="mcsf_post_author_name">
                                    <a href="{{ path('profile', {'name' : post.createdBy.username}) }}" alt="visit profile of{{ post.createdBy.username }}">
                                        {{ post.createdBy.username }}
                                    </a>
                                </p>
                                <p class="mcsf_post_author_title {{ post.createdBy.rank.cssClass }}">{{ post.createdBy.rank.name }}</p>
                            </div>
                        </div>
                        <div class="mcsf_post_content">
                            <div>
                                {{ post.text|purify }}
                            </div>
                            <div class="mcsf_post_content_lowerbar">
                                {# OPTIONS #}
                                {% if is_granted("IS_AUTHENTICATED_REMEMBERED") and post.createdBy.id == app.user.id %}
                                    <a class="button mcsf_post_option_button" href="{{ path('forum_post_edit', {'id' : thread.forum.id, 'threadid' : thread.id, 'postid': post.id}) }}">Edit</a>
                                {% endif %}
                                {% if post.likesHasUser(app.user) %}
                                    <span class="mcsf_post_like_text">You liked this!</span>
                                {% else %}
                                    <button class="mcsf_post_like mcsf_post_option_button" value="{{ post.id }}">Like</button>
                                {% endif %}

                                {% if post.likes|length > 0 %}
                                    <span class="mcsf_post_amountLikes{% if post.likes|length > 5 %} mcsf_post_amountLikes-extra{% endif %}">{{ post.likes|length }}</span>
                                {% endif %}
                                <span class="mcsf_post_createdOn">{{ post.createdOn|prettydate }}</span>
                            </div>
                            <div style="clear:right;"></div>
                        </div>
                        <div style="clear:both;"></div>
                    </div>
                    {% endfor %}
                </div>

                {# DISPLAY PAGE NAV #}
                <div class="navigation">
                    {{ knp_pagination_render(posts) }}
                </div>

                <div class="mcsf_thread_reply">
                    {% if thread.isLocked() %}
                        <p>This thread is locked.</p>
                    {% else %}
                        {% if app.user %}
                        <form id="thread_reply" action="{{ path('forum_thread_reply_ajax', {'id' :  thread.forum.id, 'threadid' : thread.id}) }}">
                            <h3>Post a reply</h3>
                            <div class="alert" id="reply-status"></div>
                            <div class="mcsf_thread_reply_form">
                                <textarea id="post_reply_text" class="redactor-init" name="content" style="height: 560px;">
                                </textarea>
                            </div>
                            <button id="thread_reply_button" style="margin-top:5px;" class="btn btn-default btn-small" type="submit">Post reply</button>
                        </form>
                        {% else %}
                            <p>You must be logged in to reply to a thread.</p>
                        {% endif %}
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block scripttags %}
    {% if is_granted('ROLE_STAFF') %}
    <script>;
        $('.user-toolbar').toolbar({
            content: '#user-toolbar-options',
            position: 'top'
        });

        $('#admin_thread_lock').on('click', function(){
            AJAX.post_noButton($(this).attr("data-href"), {
                _forumid : {{ thread.forum.id }},
                _reply_text : $('#admin_thread_lock_text').val()
            }, $("#admin-status"));
        });

        //actions
        $('#admin_thread_archive').on('click', function(){
            AJAX.post_noButton($(this).attr("data-href"),{}, $("#admin-status"));
        });

        $('#admin_thread_pin').on('click', function(){
            AJAX.post_noButton($(this).attr("data-href"),{}, $("#admin-status"));
        });

        $('#admin_thread_move').on('change', function(){
            AJAX.post_noButton($(this).attr("data-href"),{
                '_forumto' : $(this).val()
            }, $("#admin-status"));
        });

        $('.mcsf_post_like').on('click', function(){
            var url = "{{ path('forum_post_like_ajax', {'id' : 'REPLACEID'}) }}";
            url = url.replace('REPLACEID', $(this).val());
            AJAX.post_text(url, $(this), ['liking...', 'you liked this!', 'could not like']);
            $(this).attr("disabled", "disabled");
        });
    </script>
    {% endif %}
    <script>
        $('#thread_reply').submit(function(e) {
            e.preventDefault();

            AJAX.post(
                    $("#thread_reply").attr("action"),
                    {
                        _forumid : {{  thread.forum.id }},
                        _post_reply_text : $("#post_reply_text").val()
                    },
                    $("#reply-status"),
                    $('#thread_reply_button')
            );
        });
    </script>
{% endblock scripttags%}<commit_msg>Hide alert message (shadow was still visible)<commit_after>{% extends 'MaximModuleForumBundle:Default:index.html.twig' %}

{% block title %}Thread - {{ thread.title }}{% endblock title %}

{% block body %}
    <div class="page">
        <h3 class="page-header">{{ thread.title }}<p>Created on {{ thread.createdOn|date('M j \, Y H:i:s') }}</p></h3>
        <div class="page-content">
            {# MAIN TOPIC #}
            <div class="mcsf_thread" id="thread-{{ thread.id }}">

                {# STATUS BAR #}
                <div id="admin-status" class="alert"></div>

                {# BREADCRUMB BAR #}
                <ul class="breadcrumbs">
                    <li><a href="{{ path('forum_view', {'id' : thread.forum.id}) }}">{{ thread.forum.title }}</a></li>
                    <li><a href="{{ path('forum_thread_view', {'id' :  thread.forum.id, 'threadid' : thread.id}) }}" class="active" style="color:gray">{{ thread.title }}</a></li>
                </ul>

                {# ADMIN ACTION BAR #}
                {% if is_granted('ROLE_STAFF') %}
                    <ul class="mcsf_adminbar">
                        <li>
                            <select id="admin_thread_move" data-href="{{ path('forum_thread_move_ajax', {'id' : thread.id}) }}">
                                <option value="0">-- select forum --</option>
                                {% for forum in forums %}
                                    <option value="{{ forum.id }}">{{ forum.category.title }} > {{ forum.title }}</option>
                                {% endfor %}
                            </select>
                        </li>
                        <li><button data-href="{{ path('forum_thread_archive_ajax', {'id' : thread.id}) }}" id="admin_thread_archive">Archive</button></li>
                        <li><button data-href="{{ path('forum_thread_pin_ajax', {'id' : thread.id}) }}" id="admin_thread_pin">{% if thread.isPinned() %}unpin{% else %}pin{% endif %}</button></li>
                        <li><button data-href="{{ path('forum_thread_lock_ajax', {'id' : thread.id}) }}" id="admin_thread_lock">{% if thread.isLocked() %}open{% else %}close{% endif %}</button></li>
                    </ul>
                {% endif %}

                {# HEAD POST #}
                {% if page is not defined %}
                <div class="mcsf_post_main">
                    <div class="mcsf_post row">
                        <div class="mcsf_post_author large-3">
                            <div class="mcsf_post_author_image{% if thread.createdBy.granted(['ROLE_STAFF']) %} mcsf_author_staff{% endif %}">
                                <a href="{{ path('profile', {'name' : thread.createdBy.username}) }}" alt="visit profile of{{ thread.createdBy.username }}">
                                    <img src="{{ asset('/bundles/maximcms/images/blank.gif') }}" data-src="http://minotar.net/avatar/{{ thread.createdBy.username }}/85.png" alt="mc the mass logo" class="preload"/>
                                </a>
                            </div>
                            <div class="mcsf_post_author_info large-8 small-offset-1">

                                <span class="mcsf_post_author_posts">Posts: {{ thread.createdBy.posts|length }}</span>
                                {% if is_granted('ROLE_STAFF') %}
                                    <span class="mcsf_admin_userip">{{ thread.createdBy.lastIp }}</span>
                                {% endif %}
                                <p class="mcsf_post_author_name"><a href="{{ path('profile', {'name' : thread.createdBy.username}) }}" alt="visit profile of{{ thread.createdBy.username }}">{{ thread.createdBy.username }}</a></p>
                                <p class="mcsf_post_author_title {{ thread.createdBy.rank.cssClass }}">{{ thread.createdBy.rank.name }}</p>
                            </div>
                        </div>
                        <div class="mcsf_post_content">
                            <div>
                                {{ thread.text|purify }}

                                {% for update in thread.updates %}
                                    <div class="mcsf_post_update">
                                        <h6>Updated on {{ update.updatedOn|prettydate }}</h6>
                                        <p>{{ update.reason|purify }}</p>
                                    </div>
                                {% endfor %}
                            </div>
                            <div class="mcsf_post_content_lowerbar">
                                {% if is_granted("IS_AUTHENTICATED_REMEMBERED") and thread.createdBy.id == app.user.id %}
                                    <a class="button mcsf_post_option_button" href="{{ path('forum_thread_edit', {'id' : thread.forum.id, 'threadid' : thread.id}) }}">Edit</a>
                                {% endif %}
                                <span class="mcsf_post_createdOn">{{ thread.createdOn|prettydate }}</span>
                            </div>
                            <div style="clear:right;"></div>
                        </div>
                    </div>
                   <div style="clear:both;"></div>
                </div>
                {% endif %}

                {# POSTS #}
                <div class="mcsf_posts">
                    {% for post in posts %}
                    <div class="mcsf_post row">
                        <div class="mcsf_post_author large-3">
                            <div class="mcsf_post_author_image{% if post.createdBy.granted(['ROLE_STAFF']) %} mcsf_author_staff{% endif %}">
                                <a href="{{ path('profile', {'name' : post.createdBy.username}) }}" alt="visit profile of{{ post.createdBy.username }}">
                                    <img src="{{ asset('/bundles/maximcms/images/blank.gif') }}" data-src="http://minotar.net/avatar/{{ post.createdBy.username }}/85.png" alt="mc the mass logo" class="preload"/>
                                </a>
                            </div>
                            <div class="mcsf_post_author_info large-8 small-offset-1">
                                <span class="mcsf_post_author_posts">Posts: {{ post.createdBy.posts|length }}</span>
                                {% if is_granted('ROLE_STAFF') %}
                                    <span class="mcsf_admin_userip">{{ post.createdBy.lastIp }}</span>
                                {% endif %}
                                <p class="mcsf_post_author_name">
                                    <a href="{{ path('profile', {'name' : post.createdBy.username}) }}" alt="visit profile of{{ post.createdBy.username }}">
                                        {{ post.createdBy.username }}
                                    </a>
                                </p>
                                <p class="mcsf_post_author_title {{ post.createdBy.rank.cssClass }}">{{ post.createdBy.rank.name }}</p>
                            </div>
                        </div>
                        <div class="mcsf_post_content">
                            <div>
                                {{ post.text|purify }}
                            </div>
                            <div class="mcsf_post_content_lowerbar">
                                {# OPTIONS #}
                                {% if is_granted("IS_AUTHENTICATED_REMEMBERED") and post.createdBy.id == app.user.id %}
                                    <a class="button mcsf_post_option_button" href="{{ path('forum_post_edit', {'id' : thread.forum.id, 'threadid' : thread.id, 'postid': post.id}) }}">Edit</a>
                                {% endif %}
                                {% if post.likesHasUser(app.user) %}
                                    <span class="mcsf_post_like_text">You liked this!</span>
                                {% else %}
                                    <button class="mcsf_post_like mcsf_post_option_button" value="{{ post.id }}">Like</button>
                                {% endif %}

                                {% if post.likes|length > 0 %}
                                    <span class="mcsf_post_amountLikes{% if post.likes|length > 5 %} mcsf_post_amountLikes-extra{% endif %}">{{ post.likes|length }}</span>
                                {% endif %}
                                <span class="mcsf_post_createdOn">{{ post.createdOn|prettydate }}</span>
                            </div>
                            <div style="clear:right;"></div>
                        </div>
                        <div style="clear:both;"></div>
                    </div>
                    {% endfor %}
                </div>

                {# DISPLAY PAGE NAV #}
                <div class="navigation">
                    {{ knp_pagination_render(posts) }}
                </div>

                <div class="mcsf_thread_reply">
                    {% if thread.isLocked() %}
                        <p>This thread is locked.</p>
                    {% else %}
                        {% if app.user %}
                        <form id="thread_reply" action="{{ path('forum_thread_reply_ajax', {'id' :  thread.forum.id, 'threadid' : thread.id}) }}">
                            <h3>Post a reply</h3>
                            <div class="alert" id="reply-status" style="display:none;"></div>
                            <div class="mcsf_thread_reply_form">
                                <textarea id="post_reply_text" class="redactor-init" name="content" style="height: 560px;">
                                </textarea>
                            </div>
                            <button id="thread_reply_button" style="margin-top:5px;" class="btn btn-default btn-small" type="submit">Post reply</button>
                        </form>
                        {% else %}
                            <p>You must be logged in to reply to a thread.</p>
                        {% endif %}
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block scripttags %}
    {% if is_granted('ROLE_STAFF') %}
    <script>;
        $('.user-toolbar').toolbar({
            content: '#user-toolbar-options',
            position: 'top'
        });

        $('#admin_thread_lock').on('click', function(){
            AJAX.post_noButton($(this).attr("data-href"), {
                _forumid : {{ thread.forum.id }},
                _reply_text : $('#admin_thread_lock_text').val()
            }, $("#admin-status"));
        });

        //actions
        $('#admin_thread_archive').on('click', function(){
            AJAX.post_noButton($(this).attr("data-href"),{}, $("#admin-status"));
        });

        $('#admin_thread_pin').on('click', function(){
            AJAX.post_noButton($(this).attr("data-href"),{}, $("#admin-status"));
        });

        $('#admin_thread_move').on('change', function(){
            AJAX.post_noButton($(this).attr("data-href"),{
                '_forumto' : $(this).val()
            }, $("#admin-status"));
        });

        $('.mcsf_post_like').on('click', function(){
            var url = "{{ path('forum_post_like_ajax', {'id' : 'REPLACEID'}) }}";
            url = url.replace('REPLACEID', $(this).val());
            AJAX.post_text(url, $(this), ['liking...', 'you liked this!', 'could not like']);
            $(this).attr("disabled", "disabled");
        });
    </script>
    {% endif %}
    <script>
        $('#thread_reply').submit(function(e) {
            e.preventDefault();

            AJAX.post(
                    $("#thread_reply").attr("action"),
                    {
                        _forumid : {{  thread.forum.id }},
                        _post_reply_text : $("#post_reply_text").val()
                    },
                    $("#reply-status"),
                    $('#thread_reply_button')
            );
        });
    </script>
{% endblock scripttags%}
{'fraction_non_alphanumeric': 0.15665916103744476, 'fraction_numerical': 0.0019181052456008674, 'mean_word_length': 1.2888910097346822, 'pattern_counts': {'":': 0, '<': 311, '<?xml version=': 0, '>': 317, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 94, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4556099', 'n_tokens_mistral': 6792, 'n_tokens_neox': 6135, 'n_words': 1076}