<commit_before>angular.module('jnGrid', [])

  .directive('jnGridCell', [function() {
    return {
      restrict: 'EA',
      requires: 'jnGrid',
      scope: {
        content: '@'
      },
      template: '<div class="jn-cell">{{ content }}</div>'
    };
  }])

  .directive('jnGridRow', ['$compile', function($compile) {

    function createAccordion(scope, element, template) {
      if(template) {
        var el = angular.element(scope.options.template);
        el.attr('ng-show', 'row.clicked');

        element.append(el);

        $compile(el)(scope);

        element.bind('click', function() {
          scope.row.clicked = !scope.row.clicked;
          scope.$apply();
        });
      }
    }

    return {
      restrict: 'EA',
      requires: 'jnGrid',

      compile: function() {
        return {
          pre: function(scope, element) {

            var row = scope.row;
            row.clicked = false;

            element.append(row.name);
            createAccordion(scope, element, scope.options.template);

          }
        };
      }
    };
  }])

  .directive('jnGrid', ['$compile', function($compile) {
    return {
      restrict: 'EA',
      scope: {
        dataset: '=',
        options: '='
      },
      template: '<div ng-repeat="row in dataset">' +
                  '<div jn-grid-row></div>' +
                '</div>',
      link: function(scope) {
        scope.options = scope.options || {}
      }
    }
  }]);<commit_msg>Improved templating<commit_after>angular.module('jnGrid', [])

  .directive('jnGridCell', [function() {
    return {
      restrict: 'EA',
      requires: 'jnGrid',
      scope: {
        content: '@'
      },
      template: '<div class="jn-cell">{{ content }}</div>'
    };
  }])

  .directive('jnGridRow', ['$compile', function($compile) {

    function createAccordion(scope, element, template) {
      if(template) {

        template(scope, function(el) {
          element.append(el);
        });

        element.bind('click', function() {
          scope.row.clicked = !scope.row.clicked;
          scope.$apply();
        });
      }
    }

    return {
      restrict: 'EA',
      requires: 'jnGrid',

      compile: function() {
        return {
          pre: function(scope, element) {

            var row = scope.row;
            row.clicked = false;

            element.append(row.name);
            createAccordion(scope, element, scope.options.template);

          }
        };
      }
    };
  }])

  .directive('jnGrid', ['$compile', function($compile) {
    return {
      restrict: 'EA',
      scope: {
        dataset: '=',
        options: '='
      },
      template: '<div ng-repeat="row in dataset">' +
                  '<div jn-grid-row></div>' +
                '</div>',
      link: function(scope) {
        scope.options = scope.options || {}

        if(scope.options.template) {
          var el = angular.element(scope.options.template);
          el.attr('ng-show', 'row.clicked'); //append click handler | will make smarter later
          scope.options.template = $compile(el);
        }
      }
    }
  }]);
{'fraction_non_alphanumeric': 0.16853572572893302, 'fraction_numerical': 0.0, 'mean_word_length': 1.7949865711727842, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '2661177', 'n_tokens_mistral': 965, 'n_tokens_neox': 933, 'n_words': 164}