<commit_before><%
    from indico.util.date_time import format_human_date
%>

<div class="dashboard-tab">
    <div class="quick-access-pane">
        <div class="dashboard-col">
            <div id="events" class="dashboard-box">
                <h3>${_("Your events")}</h3>
                <ol>
                % if len(events) == 0:
                    <li class="no-event"><a>
                        <span class="event-title italic text-superfluous">${_("You have no events.")}</span>
                    </a></li>
                % else:
                % for event in events.values():
                    <li><a href="${event["url"]}" class="truncate">
                        <span class="event-date">${format_human_date(event["date"]).title()}</span>
                        <span class="event-title truncate-target">${event["title"]}</span>
                        <span class="item-legend">
                            <span title="You have management rights" class="icon-medal contextHelp"></span>
                            <span title="You are a reviewer" class="icon-reading contextHelp"></span>
                            <span title="You are an atendee" class="icon-ticket contextHelp"></span>
                        </span>
                    </a></li>
                % endfor
                % endif
                </ol>
            </div>
        </div>
        <div class="dashboard-col">
            <div id="yourCategories" class="dashboard-box">
                <h3>${_("Your categories")}</h3>
                <ol>
                % if len(categories) == 0:
                    <li class="no-event"><a>
                        <span class="event-title italic text-superfluous">${_("You have no categories.")}</span>
                    </a></li>
                % else:
                % for category in categories.values():
                    <li><a href="${urlHandlers.UHCategoryDisplay.getURL(category["categ"])}" class="truncate">
                        <span class="category-title truncate-target">${category["categ"].getTitle()}</span>
                        <span class="item-legend">
                            % if category["managed"] is True:
                            <span title="You have management rights" class="icon-medal contextHelp active"></span>
                            % else:
                            <span title="You have favorited this category" class="icon-star contextHelp active"></span>
                            % endif:
                        </span>
                        <span class="category-path">${category["path"]}</span>
                    </a></li>
                % endfor
                % endif
                </ol>
            </div>
            <div id="happeningCategories" class="dashboard-box">
                <h3>${_("Happening in your categories")}</h3>
                <ol>
                <%doc>
                % if len(events) != 0:
                    <li class="no-event"><a>
                        <span class="event-title italic text-superfluous">${_("You have no categories.")}</span>
                    </a></li>
                % else:
                % endif
                </%doc>
                </ol>
            </div>
        </div>
    </div>
</div>

<script>
$(document).ready(function(log_view){
    $.getJSON("http://pcuds43.cern.ch:8000/indico/export/categ/favorites.json?ak=368612c2-7029-4d28-a54b-8eb036b8f114&limit=10&from=today&order=start", function(data) {
        $.each(data.results, function(i, item) {
            $("#happeningCategories ol").append(
                    '<li class="truncate"><a href="' + item.url + '" class="truncate"> \
                        <span class="event-date">' + item.startDate.date + '</span> \
                        <span class="event-title truncate-target">' + item.title + '</span> \
                        <span class="event-category">' + item.category + '</span> \
                     </a></li>');
        });
    });

    $(".contextHelp[title]").qtip("disable");
    $(".contextHelp[title].active").qtip("enable");
});
</script><commit_msg>[IMP] Profile dashboard: api request with jquery<commit_after><%
    from indico.util.date_time import format_human_date
%>

<div class="dashboard-tab">
    <div class="quick-access-pane">
        <div class="dashboard-col">
            <div id="events" class="dashboard-box">
                <h3>${_("Your events")}</h3>
                <ol>
                % if len(events) == 0:
                    <li class="no-event"><a>
                        <span class="event-title italic text-superfluous">${_("You have no events.")}</span>
                    </a></li>
                % else:
                % for event in events.values():
                    <li><a href="${event["url"]}" class="truncate">
                        <span class="event-date">${format_human_date(event["date"]).title()}</span>
                        <span class="event-title truncate-target">${event["title"]}</span>
                        <span class="item-legend">
                            <span title="You have management rights" class="icon-medal contextHelp"></span>
                            <span title="You are a reviewer" class="icon-reading contextHelp"></span>
                            <span title="You are an atendee" class="icon-ticket contextHelp"></span>
                        </span>
                    </a></li>
                % endfor
                % endif
                </ol>
            </div>
        </div>
        <div class="dashboard-col">
            <div id="yourCategories" class="dashboard-box">
                <h3>${_("Your categories")}</h3>
                <ol>
                % if len(categories) == 0:
                    <li class="no-event"><a>
                        <span class="event-title italic text-superfluous">${_("You have no categories.")}</span>
                    </a></li>
                % else:
                % for category in categories.values():
                    <li><a href="${urlHandlers.UHCategoryDisplay.getURL(category["categ"])}" class="truncate">
                        <span class="category-title truncate-target">${category["categ"].getTitle()}</span>
                        <span class="item-legend">
                            % if category["managed"] is True:
                            <span title="You have management rights" class="icon-medal contextHelp active"></span>
                            % else:
                            <span title="You have favorited this category" class="icon-star contextHelp active"></span>
                            % endif:
                        </span>
                        <span class="category-path">${category["path"]}</span>
                    </a></li>
                % endfor
                % endif
                </ol>
            </div>
            <div id="happeningCategories" class="dashboard-box">
                <h3>${_("Happening in your categories")}</h3>
                <ol>
                <%doc>
                % if len(events) != 0:
                    <li class="no-event"><a>
                        <span class="event-title italic text-superfluous">${_("You have no categories.")}</span>
                    </a></li>
                % else:
                % endif
                </%doc>
                </ol>
            </div>
        </div>
    </div>
</div>

<script>
$(document).ready(function(log_view){
    var api_opts = {
            limit: "10",
            start: "today",
            order: "start"
    };

    apiRequest("/categ/favorites", api_opts).done(function(resp) {
        $.each(resp.results, function(i, item) {
            $("#happeningCategories ol").append(
                    '<li class="truncate"><a href="' + item.url + '" class="truncate"> \
                        <span class="event-date">' + item.startDate.date + '</span> \
                        <span class="event-title truncate-target">' + item.title + '</span> \
                        <span class="event-category">' + item.category + '</span> \
                     </a></li>');
        });
    });

    $(".contextHelp[title]").qtip("disable");
    $(".contextHelp[title].active").qtip("enable");
});
</script>
{'fraction_non_alphanumeric': 0.1600193376843123, 'fraction_numerical': 0.0062847474014986705, 'mean_word_length': 1.3902368573079145, 'pattern_counts': {'":': 0, '<': 181, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7242183', 'n_tokens_mistral': 2296, 'n_tokens_neox': 2136, 'n_words': 411}