<commit_before>{% load ndf_tags %}
{% load i18n %}

{% block head %}

  <link href="/static/ndf/bower_components/jqtree/jqtree.css" rel="stylesheet"> 
  <script src="/static/ndf/bower_components/jqtree/tree.jquery.js"></script> <!-- checked -->
    
  <script type="text/javascript">
    $(document).ready(function() {
      $(function() {

        var $tree = $('.collection');

        $tree.tree();

        $tree.bind(
          'tree.click',
          function(event) {
              // The clicked node is 'event.node'
              var node = event.node;
              // var node_type = node.node_type;

              $.ajax({
                  type: "POST",
                  url: "{% url 'collection_nav' group_id %}",
                  datatype: "html",
                  data:{
                    node_id: node.id,
                    csrfmiddlewaretoken: '{{ csrf_token }}'
                  },
                  success: function(data) {

                    // if (node_type == "Page"){
                    //  window.history.pushState("", "", "/{{group_name_tag}}/page/"+node.id+"");
                    // }
                    // else if(node_type == "File"){
                    //   window.history.pushState("", "", "/{{group_name_tag}}/file/"+node.id+"");  
                    // }
                    // else if (node_type == "Term"){
                    //   window.history.pushState("", "", "/{{group_name_tag}}/term/"+node.id+"");
                    // }
                    // else if (node_type == "Topic"){
                    //   window.history.pushState("", "", "/{{group_name_tag}}/topic_details/"+node.id+"");
                    // }
                    
                    // $("#ajax_load_image").hide();
                    // $("#content").css({"opacity":""})
                    $("#view_page").html(data);

                  }
              });

              $.ajax({
                  type: "POST",
                  url: "{% url 'collection_view' group_id %}",
                  datatype: "html",
                  data:{
                    node_id: node.id,
                    breadcrumbs_list: "{{breadcrumbs_list}}",
                    csrfmiddlewaretoken: '{{ csrf_token }}'
                  },
                  success: function(data) {

                    $("#view_collection").html(data);
                  }
              });
            
          }
        );


      });
    });
  </script>

<style type="text/css">
  
  .collection {
    border: solid thin #ddd;
    margin-bottom: 1em;
    overflow: auto;
  }

  .collection > ul li:nth-child(odd) { background: #ddd; }
  
</style>  

{% endblock %}
  
  <ul class="breadcrumbs"> 
    {% for e in breadcrumbs_list %}
        {% if topic %}
          {% get_prior_node e.0 as prior %}
            {% if prior %}              
              <li><b><a style="color:black;">{{prior.0.1}}</a></b></li>
              <li><b><a class="current" id="{{e.0}}" style="color:black;">{{e.1}}</a></b></li>
            {% endif %}
        {% else %}
          <li><b><a class="current" id="{{e.0}}" style="color:black;">{{e.1}}</a></b></li>
        {% endif %}
    {% endfor %}
  </ul>

  <div>
    <div class="collection" data-url="{% url 'get_collection' group_id node.pk %}"></div>
  </div>

<script type="text/javascript">

  $(".current").click(function() {
    
    $.ajax({
        type: "POST",
        url: "{% url 'collection_view' group_id %}",
        datatype: "html",
        data:{
          node_id: this.id,
          breadcrumbs_list: "{{breadcrumbs_list}}",
          csrfmiddlewaretoken: '{{ csrf_token }}'
        },
        success: function(data) {

          $("#view_collection").html(data);

        }
    }); 

    $.ajax({
        type: "POST",
        url: "{% url 'collection_nav' group_id %}",
        datatype: "html",
        data:{
          node_id: this.id,
          csrfmiddlewaretoken: '{{ csrf_token }}'
        },
        success: function(data) {
          $("#view_page").html(data);
        }
    }); 
   

  });

</script>
<commit_msg>on click urls on collections are activated now.<commit_after>{% load ndf_tags %}
{% load i18n %}

{% block head %}

  <link href="/static/ndf/bower_components/jqtree/jqtree.css" rel="stylesheet"> 
  <script src="/static/ndf/bower_components/jqtree/tree.jquery.js"></script> <!-- checked -->
    
  <script type="text/javascript">
    $(document).ready(function() {
      $(function() {

        var $tree = $('.collection');

        $tree.tree();

        $tree.bind(
          'tree.click',
          function(event) {
              // The clicked node is 'event.node'
              var node = event.node;
              var node_type = node.node_type;
              var breadcrumbs_list = "{{breadcrumbs_list}}";  
              var url = location.href;
              var lastSegment = url.split('/').pop();

              $.ajax({
                  type: "POST",
                  url: "{% url 'collection_nav' group_id %}",
                  datatype: "html",
                  data:{
                    node_id: node.id,
                    breadcrumbs_list: breadcrumbs_list,
                    // location: lastSegment,
                    csrfmiddlewaretoken: '{{ csrf_token }}'
                  },
                  success: function(data) {

                    if (node_type == "Page"){
                     window.history.pushState("", "", "/{{group_name_tag}}/page/"+node.id+"seleted:"+lastSegment+"");
                    }
                    else if(node_type == "File"){
                      window.history.pushState("", "", "/{{group_name_tag}}/file/"+node.id+"?seleted="+lastSegment+"");  
                    }
                    // else if (node_type == "Term"){
                      // window.history.pushState("", "", "/{{group_name_tag}}/term/"+node.id+"");
                    // }
                    // else if (node_type == "Topic"){
                    //   window.history.pushState("", "", "/{{group_name_tag}}/topic_details/"+node.id+"");
                    // }
                    
                    // $("#ajax_load_image").hide();
                    // $("#content").css({"opacity":""})
                    $("#view_page").html(data);

                  }
              });

              // $.ajax({
              //     type: "POST",
              //     url: "{#% url 'collection_view' group_id %#}",
              //     datatype: "html",
              //     data:{
              //       node_id: node.id,
              //       breadcrumbs_list: "{{breadcrumbs_list}}",
              //       csrfmiddlewaretoken: '{{ csrf_token }}'
              //     },
              //     success: function(data) {

              //       $("#view_collection").html(data);
              //     }
              // });
            
          }
        );


      });
    });
  </script>

<style type="text/css">
  
  .collection {
    border: solid thin #ddd;
    margin-bottom: 1em;
    overflow: auto;
  }

  .collection > ul li:nth-child(odd) { background: #ddd; }
  
</style>  

{% endblock %}  

  <div>
    <div class="collection" data-url="{% url 'get_collection' group_id node.pk %}"></div>
  </div>

<script type="text/javascript">

  $(".current").click(function() {
    
    // $.ajax({
    //     type: "POST",
    //     url: "{#% url 'collection_view' group_id %#}",
    //     datatype: "html",
    //     data:{
    //       node_id: this.id,
    //       breadcrumbs_list: "{{breadcrumbs_list}}",
    //       csrfmiddlewaretoken: '{{ csrf_token }}'
    //     },
    //     success: function(data) {

    //       $("#view_collection").html(data);

    //     }
    // }); 

    $.ajax({
        type: "POST",
        url: "{% url 'collection_nav' group_id %}",
        datatype: "html",
        data:{
          node_id: this.id,
          breadcrumbs_list: "{{breadcrumbs_list}}",
          csrfmiddlewaretoken: '{{ csrf_token }}'
        },
        success: function(data) {
          $("#view_page").html(data);
        }
    }); 
   

  });

</script>

{'fraction_non_alphanumeric': 0.18122297714638666, 'fraction_numerical': 0.001605929586164299, 'mean_word_length': 1.3419149551634364, 'pattern_counts': {'":': 2, '<': 51, '<?xml version=': 0, '>': 53, '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': '3228375', 'n_tokens_mistral': 2480, 'n_tokens_neox': 2332, 'n_words': 379}