<commit_before>/**
 * Public lading page for an election
 */
angular.module('avElection')
  .directive('aveDefaultElection', function($state, $stateParams) {
    function link(scope, element, attrs) {
      scope.getShareLink = function() {
        if (!scope.election) {
          return "";
        }
        return "https://twitter.com/intent/tweet?text=" + encodeURIComponent(scope.election.presentation.share_text) + "&source=webclient";
      };
      scope.name = function () {
        return $state.current.name.replace("election.public.show.", "");
      };

      scope.pageName = function() {
        return $stateParams.name;
      };
      
      scope.checkState = function (validStates) {
        return _.contains(validStates, scope.electionState);
      };
    }
    return {<commit_msg>fix public tweet<commit_after>/**
 * Public lading page for an election
 */
angular.module('avElection')
  .directive('aveDefaultElection', function($state, $stateParams, $i18next, $location) {
    function link(scope, element, attrs) {
      scope.getShareLink = function() {
        if (!scope.election) {
          return "";
        }

        var text = scope.election.presentation.share_text;
        if (!text || text.length === 0) {
          var title = scope.election.title.substr(0, 40);
          if (title.length > 40) {
            title += "..";
          }
          text = $i18next(
            "avElection.defaultShareText",
            {
              title: title,
              url: $location.absUrl()
            });
        }

        return "https://twitter.com/intent/tweet?text=" + encodeURIComponent(text) + "&source=webclient";
      };
      scope.name = function () {
        return $state.current.name.replace("election.public.show.", "");
      };

      scope.pageName = function() {
        return $stateParams.name;
      };
      
      scope.checkState = function (validStates) {
        return _.contains(validStates, scope.electionState);
      };
    }
    return {
{'fraction_non_alphanumeric': 0.14235938277750124, 'fraction_numerical': 0.004977600796416127, 'mean_word_length': 2.1904761904761907, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 2, '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': '3142817', 'n_tokens_mistral': 574, 'n_tokens_neox': 566, 'n_words': 104}