{% extends 'users/base.html' %}

{% block user_content %}
    <div class="layout-wrapper">
        <div id="user-favorites" data-search-token="{{ make_user_search_token(public=true) or '' }}"></div>
    </div>
    <script>
        setupFavoriteSelection({{ (user.id if user != session.user else none) | tojson }});
        (function() {
            $('.js-delete-category').on('click', function(e){
                e.preventDefault();
                var $this = $(this);
                $.ajax({
                    url: $this.data('href'),
                    method: 'DELETE',
                    error: handleAjaxError,
                    success: function() {
                        $this.closest('li.category-box').fadeOut(function() {
                            $(this).remove();
                            delete Indico.User.favorite_users[$(this).closest('li').data('user-id')];
                        });
                    }
                });
            });
       })();
    </script>
{% endblock %}
