<commit_before>/**
 * This file is part of agora-gui-admin.
 * Copyright (C) 2015-2016  <NAME> <<EMAIL>>

 * agora-gui-admin is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License.

 * agora-gui-admin  is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.

 * You should have received a copy of the GNU Affero General Public License
 * along with agora-gui-admin.  If not, see <http://www.gnu.org/licenses/>.
**/

angular.module('avAdmin')
  .directive(
    'avAdminElcensus',
    function(
      $window,
      $state,
      ElectionsApi,
      Authmethod,
      Plugins,
      SendMsg,
      $modal,
      MustExtraFieldsService,
      $filter,
      $stateParams,
      $timeout,
      ConfigService)
    {
    // we use it as something similar to a controller here
    function link(scope, element, attrs) {
      scope.census = ['open', 'close'];
      scope.election = ElectionsApi.currentElection;
      scope.newcensus = {};
      scope.electionLoaded = false;
      scope.reloadingCensus = false;
      scope.loading = false;
      scope.nomore = false;
      scope.error = null;
      scope.page = 1;
      scope.msg = null;
      scope.filterStr = "";
      scope.$filter = $filter;
      scope.filterTimeout = null;
      scope.filterOptions = {};
      scope.resizeSensor = null;
      scope.helpurl = ConfigService.helpUrl;
      $scope.showSuccessAction = ConfigService.showSuccessAction;

      function newElection() {
        return !$stateParams.id;
      }

      scope.commands = [
        {
          i18nString: 'addPersonAction',
          iconClass: 'fa fa-plus',
          actionFunc: function() { return scope.addPersonModal(); },
          enableFunc: function() { return true; }
        },
        {
          i18nString: 'addCsvAction',
          iconClass: 'fa fa-plus',
          actionFunc: function() { return scope.addCsvModal(); },
          enableFunc: function() { return true; }
        },
        {
          i18nString: 'exportCensusAction',
          iconClass: 'fa fa-download',
          actionFunc: function() { return scope.exportCensusModal(); },
          enableFunc: function() {
            return (
              scope.election && scope.election.census &&
              scope.election.census.voters &&
              scope.election.census.voters.length);
          }
        },
        {<commit_msg>a letter<commit_after>/**
 * This file is part of agora-gui-admin.
 * Copyright (C) 2015-2016  Agora Voting SL <<EMAIL>>

 * agora-gui-admin is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License.

 * agora-gui-admin  is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.

 * You should have received a copy of the GNU Affero General Public License
 * along with agora-gui-admin.  If not, see <http://www.gnu.org/licenses/>.
**/

angular.module('avAdmin')
  .directive(
    'avAdminElcensus',
    function(
      $window,
      $state,
      ElectionsApi,
      Authmethod,
      Plugins,
      SendMsg,
      $modal,
      MustExtraFieldsService,
      $filter,
      $stateParams,
      $timeout,
      ConfigService)
    {
    // we use it as something similar to a controller here
    function link(scope, element, attrs) {
      scope.census = ['open', 'close'];
      scope.election = ElectionsApi.currentElection;
      scope.newcensus = {};
      scope.electionLoaded = false;
      scope.reloadingCensus = false;
      scope.loading = false;
      scope.nomore = false;
      scope.error = null;
      scope.page = 1;
      scope.msg = null;
      scope.filterStr = "";
      scope.$filter = $filter;
      scope.filterTimeout = null;
      scope.filterOptions = {};
      scope.resizeSensor = null;
      scope.helpurl = ConfigService.helpUrl;
      scope.showSuccessAction = ConfigService.showSuccessAction;

      function newElection() {
        return !$stateParams.id;
      }

      scope.commands = [
        {
          i18nString: 'addPersonAction',
          iconClass: 'fa fa-plus',
          actionFunc: function() { return scope.addPersonModal(); },
          enableFunc: function() { return true; }
        },
        {
          i18nString: 'addCsvAction',
          iconClass: 'fa fa-plus',
          actionFunc: function() { return scope.addCsvModal(); },
          enableFunc: function() { return true; }
        },
        {
          i18nString: 'exportCensusAction',
          iconClass: 'fa fa-download',
          actionFunc: function() { return scope.exportCensusModal(); },
          enableFunc: function() {
            return (
              scope.election && scope.election.census &&
              scope.election.census.voters &&
              scope.election.census.voters.length);
          }
        },
        {
{'fraction_non_alphanumeric': 0.10360276274033975, 'fraction_numerical': 0.005973492626470039, 'mean_word_length': 2.247272727272727, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6029256', 'n_tokens_mistral': 1505, 'n_tokens_neox': 1475, 'n_words': 429}