<commit_before>'use strict';

angular.module('ui.dashboard', ['ui.bootstrap', 'ui.sortable']);

angular.module('ui.dashboard')
  .directive('dashboard', function () {
    return {
      restrict: 'A',
      templateUrl: 'template/dashboard.html',
      scope: true,
      controller: function ($scope) {
        $scope.sortableOptions = {
          stop: function () {
            //TODO store active widgets in local storage on add/remove/reorder
            //var titles = _.map($scope.widgets, function (widget) {
            //  return widget.title;
            //});
            //console.log(titles);
          }
        };
      },
      link: function (scope, element, attrs) {
        scope.options = scope.$eval(attrs.dashboard);

        var count = 1;

        scope.addWidget = function (directive, attrs, style) {
          scope.widgets.push({
            title: 'Widget ' + count++,
            directive: directive,
            attrs: attrs,
            style: style
          });
        };

        scope.removeWidget = function (widget) {
          scope.widgets.splice(_.indexOf(scope.widgets, widget), 1);
        };

        scope.clear = function () {
          scope.widgets = [];
        };

        scope.widgets = [];
        _.each(scope.options.defaultWidgets, function (widgetDefinition) {
          scope.addWidget(widgetDefinition.directive, widgetDefinition.attrs, widgetDefinition.style);
        });

        scope.addWidgetInternal = function (event, widget) {
          event.preventDefault();
          scope.addWidget(widget.directive, widget.attrs);
        };

        // allow adding widgets externally
        scope.options.addWidget = scope.addWidget;
      }
    };
  })
  .directive('widget', ['$compile', function ($compile) {
    return {
      require: '^dashboard',
      link: function (scope, element) {
        var elm = element.find('.widget-content > div');

        var widget = scope.widget;
        elm.attr(widget.directive, '');

        if (widget.attrs) {
          _.each(widget.attrs, function (value, attr) {
            elm.attr(attr, value);
          });
        }

        $compile(elm)(scope);
      }
    };
  }]);<commit_msg>widget style definition<commit_after>'use strict';

angular.module('ui.dashboard', ['ui.bootstrap', 'ui.sortable']);

angular.module('ui.dashboard')
  .directive('dashboard', function () {
    return {
      restrict: 'A',
      templateUrl: 'template/dashboard.html',
      scope: true,
      controller: function ($scope) {
        $scope.sortableOptions = {
          stop: function () {
            //TODO store active widgets in local storage on add/remove/reorder
            //var titles = _.map($scope.widgets, function (widget) {
            //  return widget.title;
            //});
            //console.log(titles);
          }
        };
      },
      link: function (scope, element, attrs) {
        scope.options = scope.$eval(attrs.dashboard);

        var count = 1;

        scope.addWidget = function (directive, attrs, style) {
          scope.widgets.push({
            title: 'Widget ' + count++,
            directive: directive,
            attrs: attrs,
            style: style
          });
        };

        scope.removeWidget = function (widget) {
          scope.widgets.splice(_.indexOf(scope.widgets, widget), 1);
        };

        scope.clear = function () {
          scope.widgets = [];
        };

        scope.widgets = [];
        _.each(scope.options.defaultWidgets, function (widgetDefinition) {
          scope.addWidget(widgetDefinition.directive, widgetDefinition.attrs, widgetDefinition.style);
        });

        scope.addWidgetInternal = function (event, widget) {
          event.preventDefault();
          scope.addWidget(widget.directive, widget.attrs, widget.style);
        };

        // allow adding widgets externally
        scope.options.addWidget = scope.addWidget;
      }
    };
  })
  .directive('widget', ['$compile', function ($compile) {
    return {
      require: '^dashboard',
      link: function (scope, element) {
        var elm = element.find('.widget-content > div');

        var widget = scope.widget;
        elm.attr(widget.directive, '');

        if (widget.attrs) {
          _.each(widget.attrs, function (value, attr) {
            elm.attr(attr, value);
          });
        }

        $compile(elm)(scope);
      }
    };
  }]);
{'fraction_non_alphanumeric': 0.13981900452488688, 'fraction_numerical': 0.0009049773755656109, 'mean_word_length': 1.9104674127715602, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7432093', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1198, 'n_words': 243}