<commit_before>{% load static %}
{% load url from future %}
{% load gamification_tags %}
{% load version %}

<script>
    function getbadges() {
        var host = "{% gamification_value 'GAMIFICATION_SERVER' %}";
        var project = "{% gamification_value 'GAMIFICATION_PROJECT' %}";
        var user = "{{ request.user.username }}";

        var $badge_container = $("#badge-container");
        if ( user != undefined && user.length > 0 && host && project) {
            var badgeUrl = host + '/users/' + user + '/projects/' + project + '/badges?format=json';

            var proxiedURL = "/geoq/proxy/" + encodeURI(badgeUrl);
            proxiedURL = proxiedURL.replace(/%253D/g,'%3D');

            $.ajax({
                type: 'GET',
                url: proxiedURL,
                dataType: 'json',
                timeout: 3000,
                success: function (badge_info, textstatus, jqXHR) {
                    if ($badge_container && badge_info.profile && badge_info.profile.length ) {
                        for (var i = 0; i < badge_info.profile.length; i++ ) {
                            var badge = badge_info.profile[i];
                            var $span = $('<span>')
                                    .attr('id','badge_header_'+ _.str.dasherize(badge.projectbadge__name))
                                    .attr('title',badge.projectbadge__name)
                                    .popover({
                                        title:badge.projectbadge__name + " ("+badge.count+")",
                                        content:badge.projectbadge__description,
                                        trigger:'hover',
                                        placement:'bottom'
                                    })
                                    .addClass('badge_holder')
                                    .appendTo($badge_container);
                            $('<img>')
                                    .attr('src',badge.projectbadge__badge__icon)
                                    .appendTo($span);
                            $('<span>')
                                    .text(badge.count)
                                    .appendTo($span);
                        }
                        $badge_container.show();
                    } else {
                        $badge_container.append("None yet");
                    }
                },
                error: function(xhr, err){
                    $badge_container.hide();
                }
            });
        } else {
            $badge_container.hide();
        }
    }

    $(document).ready(function() {
        getbadges();
    });
</script>



<div class="navbar navbar-fixed-top">

    <div class="navbar-inner">
        {% block menu %}
            <div class="container-fluid">
                <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </a>
                <a class="brand" href="{%url 'home' %}">{% block brand %}GeoQ{% endblock %}</a>
                <div class="btn-group pull-right">
                    <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="icon-user"></i> {{request.user.username}}
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        {% if request.user.is_authenticated %}
                            {% if request.user.is_staff%}
                                <li><a href="{% url 'admin:index' %}" target="_new">Admin Site</a></li>
                                <li class="divider"></li>
                            {% endif %}
                                <li><a href="{% url 'userena_profile_edit' request.user.username %}">Edit Profile</a></li>
                                <li><a href="{% url 'userena_signout' %}">Sign Out</a></li>
                        {% else %}
                                <li><a href="{% url 'userena_signin' %}?next={{ request.path }}">Sign In</a></li>
                                <li><a href="{% url 'userena_signup' %}?next={{ request.path }}">Sign Up</a></li>
                        {% endif%}
                        <li><a href="#">{% version_date %}</a></li>

                    </ul>
                </div>
                <div class="nav-collapse">
                    <ul class="nav navbar-nav">
                        {%for key,value in menu_items.items%}
                            {%if not value.dropdown%}
                                <li class="{% if value.active %}active{% endif%}"><a href="{{value.url}}"  {% if value.target %}target="{{ value.target }}"{% endif %} >{{key}}</a></li>
                            {%else%}
                                <li class="dropdown {%if value.active%}active{%endif%}">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                        {{key}}
                                        <b class="caret"></b>
                                    </a>
                                    <ul class="dropdown-menu">
                                        {%for k,v in value.dropdown.items%}
                                            {% if k == "break" %}
                                                <li class="divider"></li>
                                            {% else %}
                                                <li><a href="{{v.url}}" {% if v.target %}target="{{ v.target }}"{% endif %}>{{k}}</a></li>
                                            {% endif %}
                                        {%endfor%}
                                    </ul>
                                </li>
                            {%endif%}
                        {%endfor%}
                    </ul>
                    <ul class="nav navbar-right">

                        <li id="navbar-badges" class="text-right">
                            <p id="badge-container" class="navbar-text user-badge">
                                <span class="muted">Badges:</span>
                            </p>
                        </li>
                    </ul>
                </div><!--/.nav-collapse -->
            </div>
        {% endblock %}
    </div>
</div>
<commit_msg>Minor change in showing badges<commit_after>{% load static %}
{% load url from future %}
{% load gamification_tags %}
{% load version %}

<script>
    function getbadges() {
        var host = "{% gamification_value 'GAMIFICATION_SERVER' %}";
        var project = "{% gamification_value 'GAMIFICATION_PROJECT' %}";
        var user = "{{ request.user.username }}";

        var $badge_container = $("#badge-container");
        if ( user != undefined && user.length > 0 && host && project) {
            var badgeUrl = host + '/users/' + user + '/projects/' + project + '/badges?format=json';

            var proxiedURL = "/geoq/proxy/" + encodeURI(badgeUrl);
            proxiedURL = proxiedURL.replace(/%253D/g,'%3D');

            $.ajax({
                type: 'GET',
                url: proxiedURL,
                dataType: 'json',
                timeout: 3000,
                success: function (badge_info, textstatus, jqXHR) {
                    if ($badge_container && badge_info.profile && badge_info.profile.length ) {
                        var maxBadgesToShow = 6;
                        if (badge_info.profile.length < maxBadgesToShow) maxBadgesToShow = badge_info.profile.length;
                        for (var i = 0; i < maxBadgesToShow; i++ ) {
                            var badge = badge_info.profile[i];
                            var $span = $('<span>')
                                    .attr('id','badge_header_'+ _.str.dasherize(badge.projectbadge__name))
                                    .attr('title',badge.projectbadge__name)
                                    .popover({
                                        title:badge.projectbadge__name + " ("+badge.count+")",
                                        content:badge.projectbadge__description,
                                        trigger:'hover',
                                        placement:'bottom'
                                    })
                                    .addClass('badge_holder')
                                    .appendTo($badge_container);
                            $('<img>')
                                    .attr('src',badge.projectbadge__badge__icon)
                                    .appendTo($span);
                            $('<span>')
                                    .text(badge.count)
                                    .appendTo($span);
                        }
                        $badge_container
                            .click(function(){
                                window.open(host+'/projects/'+project+'/','_blank');
                            })
                            .css({cursor:'pointer'});

                        $badge_container.show();
                    } else {
                        $badge_container.append("None yet");
                    }
                },
                error: function(xhr, err){
                    $badge_container.hide();
                }
            });
        } else {
            $badge_container.hide();
        }
    }

    $(document).ready(function() {
        getbadges();
    });
</script>



<div class="navbar navbar-fixed-top">

    <div class="navbar-inner">
        {% block menu %}
            <div class="container-fluid">
                <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </a>
                <a class="brand" href="{%url 'home' %}">{% block brand %}GeoQ{% endblock %}</a>
                <div class="btn-group pull-right">
                    <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="icon-user"></i> {{request.user.username}}
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        {% if request.user.is_authenticated %}
                            {% if request.user.is_staff%}
                                <li><a href="{% url 'admin:index' %}" target="_new">Admin Site</a></li>
                                <li class="divider"></li>
                            {% endif %}
                                <li><a href="{% url 'userena_profile_edit' request.user.username %}">Edit Profile</a></li>
                                <li><a href="{% url 'userena_signout' %}">Sign Out</a></li>
                        {% else %}
                                <li><a href="{% url 'userena_signin' %}?next={{ request.path }}">Sign In</a></li>
                                <li><a href="{% url 'userena_signup' %}?next={{ request.path }}">Sign Up</a></li>
                        {% endif%}
                        <li><a href="#">{% version_date %}</a></li>

                    </ul>
                </div>
                <div class="nav-collapse">
                    <ul class="nav navbar-nav">
                        {%for key,value in menu_items.items%}
                            {%if not value.dropdown%}
                                <li class="{% if value.active %}active{% endif%}"><a href="{{value.url}}"  {% if value.target %}target="{{ value.target }}"{% endif %} >{{key}}</a></li>
                            {%else%}
                                <li class="dropdown {%if value.active%}active{%endif%}">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                        {{key}}
                                        <b class="caret"></b>
                                    </a>
                                    <ul class="dropdown-menu">
                                        {%for k,v in value.dropdown.items%}
                                            {% if k == "break" %}
                                                <li class="divider"></li>
                                            {% else %}
                                                <li><a href="{{v.url}}" {% if v.target %}target="{{ v.target }}"{% endif %}>{{k}}</a></li>
                                            {% endif %}
                                        {%endfor%}
                                    </ul>
                                </li>
                            {%endif%}
                        {%endfor%}
                    </ul>
                    <ul class="nav navbar-right">

                        <li id="navbar-badges" class="text-right">
                            <p id="badge-container" class="navbar-text user-badge">
                                <span class="muted">Badges:</span>
                            </p>
                        </li>
                    </ul>
                </div><!--/.nav-collapse -->
            </div>
        {% endblock %}
    </div>
</div>

{'fraction_non_alphanumeric': 0.14304922686188093, 'fraction_numerical': 0.0015686860386942556, 'mean_word_length': 0.9682446339311968, 'pattern_counts': {'":': 0, '<': 182, '<?xml version=': 0, '>': 181, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 72, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3498876', 'n_tokens_mistral': 3443, 'n_tokens_neox': 3094, 'n_words': 598}