<commit_before>{% extends "layouts/base.html" %}
{% load i18n %}


{% block title %}
{{ block.super }}{% for bread_crumb in bread_crumb_trail %} | {{ bread_crumb.get_name }}{% endfor %}
{% endblock %}


{% block body %}
<!-- lava-container -->
<div id="lava-container">

  {% block header %}
  <!-- header -->
  <div id="lava-panel">

    {% block menu %}
    <!-- menu -->
    {% for menu in lava.menu_list %}
    <a class="lava-panel-element{% if menu.sub_menu %} has-menu{% endif %}" href="{{ menu.url }}">{{ menu.label }}{% if menu.sub_menu %} &#x25BE;{% endif %}</a>
    {% if menu.sub_menu %}
    <ul class="lava-panel-menu">
    {% for sub_menu in menu.sub_menu %}
      <li><a href="{{ sub_menu.url }}">{{ sub_menu.label }}</a></li>
    {% endfor %}
    </ul>
    {% endif %}
    {% endfor %}
    <!-- !menu -->
    {% endblock menu %}

    <!-- empty spacer to separate menu from indicators -->
    <div class="lava-panel-element no-hover" id="lava-panel-spacer"></div>

    <!-- ajax indicator -->
    <div class="lava-panel-element lava-indicator no-hover" id="lava-ajax-indicator">
      <img src="{{ STATIC_URL }}lava-server/images/ajax-loader.gif" alt="AJAX progress indicator"/>
    </div>
    <script type="text/javascript">
      $(document).ajaxStart(function() {
        $('#lava-ajax-indicator').animate({
          opacity: 1.0
        }, "fast", function() {
        });
      }).ajaxStop(function() {
        $('#lava-ajax-indicator').animate({
          opacity: 0.0
        }, "fast", function() {
          $("#lava-ajax-indicator").css("display", "hidden");
        });
      });
    </script>
    <!-- !ajax indicator -->

    <!-- user indicator -->
    <div class="lava-indicator lava-panel-element has-menu" id="lava-user-indicator">
      <img 
      src="{{ STATIC_URL }}lava-server/images/avatar-default-symbolic.svg"
      width="18" height="18"/>
      {% if user.is_authenticated %}
      <a href="{% url lava.me %}" class="username">{{user.get_full_name|default:user.username}}</a>
      {% else %}
      <a href="{% url django.contrib.auth.views.login %}" class="username"
        >{% trans "Guest" %}</a>
      {% endif %}
    </div>
    <ul class="lava-panel-menu">
      {% if user.is_authenticated %}
      <li><a class="sign-out"
        href="{% url django.contrib.auth.views.logout %}"
        >{% trans "Sign out" %}</a></li>
      {% else %}
      <li><a class="sign-in"
        href="{% url django.contrib.auth.views.login %}"
        >{% trans "Sign in" %}</a></li>
      {% endif %}
      {% if user.is_staff %}
      <li><a class="admin-site" href="{% url admin:index %}"
        >{% trans "Administration" %}</a></li>
      {% endif %}
    </ul>
    <!-- !user indicator -->

  </div>
  <!-- !panel -->

  <script type="text/javascript">
    $(document).ready(function(){  
      // When true sub-mens should open on hover.
      // This mode is enabled by the first click on a top-level menu.
      var menu_should_open = false;

      var current_menu = null;
      var current_sub_menu = null;

      function close_current_menu() {
        if (current_menu) {
          current_menu.removeClass("active");
          current_menu = null;
        }
        if (current_sub_menu) {
          current_sub_menu.slideUp("fast");
          current_sub_menu = null;
        }
      }

      // Leaving the panel closes all menus and disables "preview" mode where
      // menus open automatically.
      $("#lava-panel").bind('mouseleave', function() {
        menu_should_open = false;
        close_current_menu();
      });

      $('.lava-panel-element')
        .bind('mouseenter', function() {
          if (menu_should_open) {
            close_current_menu();
            if ($(this).hasClass("has-menu")) {
              $(this).click();
            }
          }
        });

      // Clicking on a panel element with a menu does stuff
      $('.lava-panel-element.has-menu')
        .click(function(event) {
          // Enter hover-mode
          menu_should_open = true;
          if ($(this).next(".lava-panel-menu").is(":visible")) {
            // Clicking on a menu with a visible sub-menu just triggers the link
            return;
          }
          // Since our menu headers are links (for compatibility) let's prevent
          // the default link action from firing
          event.preventDefault();

          // The top absolute position of the menu.
          // Defaults to the bottom border of the panel
          // with the border size (2px) substracted to make
          // both borders overlap and look nicer
          var _top = $("#lava-panel").outerHeight(false) - 2;

          // The left absolute position of the menu.
          // defaults to the offset of the indicator span
          var _left = $(this).offset().left

          // Check how much horizontal space we have so that the menu
          // does not resize the page. The idea is to get the width of
          // the panel and remove the left offset of the indicator box.
          // If the box would be squeezed (smaller than minimum size) then
          // let's keep the size to minimum and move the left offset
          // to compensate;
          var avail_width = $("#lava-panel").outerWidth(true) - $(this).offset().left;

          var orig_width = $(this).next(".lava-panel-menu").width();
          var menu_width = $(this).outerWidth(false);
          var sub_menu_width = $(this).next(".lava-panel-menu").outerWidth(true);
          var _width = menu_width - 4;

          // Center the sub-menu if it is wider than the menu itself
          if (sub_menu_width > menu_width) {
            _left -= (sub_menu_width - menu_width) / 2;
            _width = sub_menu_width;
          }
          // Relocate the sub-menu if we ran out of space
          if (_width > avail_width) {
            _width = sub_menu_width; 
            _left = $("#lava-panel").outerWidth(true) - sub_menu_width;
          }
          // Show the sub menu 
          var self = $(this);
          current_menu = self;
          current_sub_menu = self.next(".lava-panel-menu");

          // Add an 'active' class to the current menu, this showes up as a nice gradient
          current_menu
            .addClass("active");
          // Repositiobn and slide down the sub menu
          current_sub_menu
            .css({
              top: _top,
              left: _left,<commit_msg>Make the user menu stay inside the window on FF 3.6<commit_after>{% extends "layouts/base.html" %}
{% load i18n %}


{% block title %}
{{ block.super }}{% for bread_crumb in bread_crumb_trail %} | {{ bread_crumb.get_name }}{% endfor %}
{% endblock %}


{% block body %}
<!-- lava-container -->
<div id="lava-container">

  {% block header %}
  <!-- header -->
  <div id="lava-panel">

    {% block menu %}
    <!-- menu -->
    {% for menu in lava.menu_list %}
    <a class="lava-panel-element{% if menu.sub_menu %} has-menu{% endif %}" href="{{ menu.url }}">{{ menu.label }}{% if menu.sub_menu %} &#x25BE;{% endif %}</a>
    {% if menu.sub_menu %}
    <ul class="lava-panel-menu">
    {% for sub_menu in menu.sub_menu %}
      <li><a href="{{ sub_menu.url }}">{{ sub_menu.label }}</a></li>
    {% endfor %}
    </ul>
    {% endif %}
    {% endfor %}
    <!-- !menu -->
    {% endblock menu %}

    <!-- empty spacer to separate menu from indicators -->
    <div class="lava-panel-element no-hover" id="lava-panel-spacer"></div>

    <!-- ajax indicator -->
    <div class="lava-panel-element lava-indicator no-hover" id="lava-ajax-indicator">
      <img src="{{ STATIC_URL }}lava-server/images/ajax-loader.gif" alt="AJAX progress indicator"/>
    </div>
    <script type="text/javascript">
      $(document).ajaxStart(function() {
        $('#lava-ajax-indicator').animate({
          opacity: 1.0
        }, "fast", function() {
        });
      }).ajaxStop(function() {
        $('#lava-ajax-indicator').animate({
          opacity: 0.0
        }, "fast", function() {
          $("#lava-ajax-indicator").css("display", "hidden");
        });
      });
    </script>
    <!-- !ajax indicator -->

    <!-- user indicator -->
    <div class="lava-indicator lava-panel-element has-menu" id="lava-user-indicator">
      <img 
      src="{{ STATIC_URL }}lava-server/images/avatar-default-symbolic.svg"
      width="18" height="18"/>
      {% if user.is_authenticated %}
      <a href="{% url lava.me %}" class="username">{{user.get_full_name|default:user.username}}</a>
      {% else %}
      <a href="{% url django.contrib.auth.views.login %}" class="username"
        >{% trans "Guest" %}</a>
      {% endif %}
    </div>
    <ul class="lava-panel-menu">
      {% if user.is_authenticated %}
      <li><a class="sign-out"
        href="{% url django.contrib.auth.views.logout %}"
        >{% trans "Sign out" %}</a></li>
      {% else %}
      <li><a class="sign-in"
        href="{% url django.contrib.auth.views.login %}"
        >{% trans "Sign in" %}</a></li>
      {% endif %}
      {% if user.is_staff %}
      <li><a class="admin-site" href="{% url admin:index %}"
        >{% trans "Administration" %}</a></li>
      {% endif %}
    </ul>
    <!-- !user indicator -->

  </div>
  <!-- !panel -->

  <script type="text/javascript">
    $(document).ready(function(){  
      // When true sub-mens should open on hover.
      // This mode is enabled by the first click on a top-level menu.
      var menu_should_open = false;

      var current_menu = null;
      var current_sub_menu = null;

      function close_current_menu() {
        if (current_menu) {
          current_menu.removeClass("active");
          current_menu = null;
        }
        if (current_sub_menu) {
          current_sub_menu.slideUp("fast");
          current_sub_menu = null;
        }
      }

      // Leaving the panel closes all menus and disables "preview" mode where
      // menus open automatically.
      $("#lava-panel").bind('mouseleave', function() {
        menu_should_open = false;
        close_current_menu();
      });

      $('.lava-panel-element')
        .bind('mouseenter', function() {
          if (menu_should_open) {
            close_current_menu();
            if ($(this).hasClass("has-menu")) {
              $(this).click();
            }
          }
        });

      // Clicking on a panel element with a menu does stuff
      $('.lava-panel-element.has-menu')
        .click(function(event) {
          // Enter hover-mode
          menu_should_open = true;
          if ($(this).next(".lava-panel-menu").is(":visible")) {
            // Clicking on a menu with a visible sub-menu just triggers the link
            return;
          }
          // Since our menu headers are links (for compatibility) let's prevent
          // the default link action from firing
          event.preventDefault();

          // The top absolute position of the menu.
          // Defaults to the bottom border of the panel
          // with the border size (2px) substracted to make
          // both borders overlap and look nicer
          var _top = $("#lava-panel").outerHeight(false) - 2;

          // The left absolute position of the menu.
          // defaults to the offset of the indicator span
          var _left = $(this).offset().left

          // Check how much horizontal space we have so that the menu
          // does not resize the page. The idea is to get the width of
          // the panel and remove the left offset of the indicator box.
          // If the box would be squeezed (smaller than minimum size) then
          // let's keep the size to minimum and move the left offset
          // to compensate;
          var avail_width = $("#lava-panel").outerWidth(true) - $(this).offset().left;

          var orig_width = $(this).next(".lava-panel-menu").width();
          var menu_width = $(this).outerWidth(false);
          var sub_menu_width = $(this).next(".lava-panel-menu").outerWidth(true);
          var _width = menu_width - 4;

          // Center the sub-menu if it is wider than the menu itself
          if (sub_menu_width > menu_width) {
            _left -= (sub_menu_width - menu_width) / 2;
            _width = sub_menu_width;
          }
          // Relocate the sub-menu if we ran out of space
          if (_width > avail_width) {
            _width = sub_menu_width; 
            _left = $("#lava-panel").outerWidth(true) - sub_menu_width - 4;
          }
          // Show the sub menu 
          var self = $(this);
          current_menu = self;
          current_sub_menu = self.next(".lava-panel-menu");

          // Add an 'active' class to the current menu, this showes up as a nice gradient
          current_menu
            .addClass("active");
          // Repositiobn and slide down the sub menu
          current_sub_menu
            .css({
              top: _top,
              left: _left,
{'fraction_non_alphanumeric': 0.15614824003721509, 'fraction_numerical': 0.0027135990075980772, 'mean_word_length': 2.006059193661151, 'pattern_counts': {'":': 2, '<': 103, '<?xml version=': 0, '>': 107, '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': '5205492', 'n_tokens_mistral': 3998, 'n_tokens_neox': 3760, 'n_words': 1022}