{% extends "includes/nav.html"  %}

{% block menu %}
  {{ block.super }}
  {# replace "mon-compte" menu item by user name #}
  {% if imio_username_in_nav %}
    {% skeleton_extra_placeholder "user-script-infos" %}
    <script>
      var $conn_menu_item = $('#nav > ul > li.menu-connexion');
      {% if user.is_authenticated %}
        $conn_menu_item.find('> a span').text("{{ user.first_name|escapejs }} {{ user.last_name|escapejs }}");
      {% else %}
        $conn_menu_item.find('> a').attr('href', '/login/');
        $conn_menu_item.find('ul').remove();
      {% endif %}
      $('#nav ul ul').parent('li').addClass('has-submenu');
    </script>
  {% end_skeleton_extra_placeholder %}
{% endif %}
{% endblock %}
