<commit_before>'use strict';
angular.module('LatexEditor').controller('EditorIndexController', ['$scope', 'textAngularManager',  '$document', '$http', 'pdfDelegate', 'latexParser', function($scope, textAngularManager, $document, $http, pdfDelegate, latexParser) {
    $scope.data = {orightml: ''};
    $scope.data.htmlcontent = $scope.data.orightml;
    $scope.disabled = false;
    $scope.canEdit = true;

    /**
    * Make a request to the server in order to get a pdf file.
    *
    * @param {string} htmlString String to generate pdf from HTML.
    */
    $scope.download = function(htmlString) {

      var latexString = latexParser.html2latex(htmlString);

      $http.post("/compile/template.tex", {"latexCode": latexString})
      .success(function(data, status, headers, config) {
        if (data.error) {
          alert(data.error);
        };
        if (typeof data.redirect === 'string') {
          pdfDelegate.$getByHandle('pdf-preview').load(data.redirect);
          //window.open(data.redirect, '_new', 'toolbar=yes, location=yes, status=yes, menubar=yes, scrollbars=yes');
        } 
      }).error(function(data, status, headers, config) {
        //TODO: Error Handling
        console.log('nope');
        //alert(data.error);
      })
    };
}]);<commit_msg>destroyed index-controller.js<commit_after>'use strict';
angular.module('LatexEditor').controller('EditorIndexController', ['$scope', 'textAngularManager',  '$document', '$http', 'pdfDelegate', 'latexParser', '$modal', function($scope, textAngularManager, $document, $http, pdfDelegate, latexParser, $modal) {
    $scope.data = {orightml: ''};
    $scope.data.htmlcontent = $scope.data.orightml;
    $scope.disabled = false;
    $scope.canEdit = true;
    
    $scope.sender = {"name": '', "adress": '', "city": ''};


    /**
    * Make a request to the server in order to get a pdf file.
    *
    * @param {string} htmlString String to generate pdf from HTML.
    */
    $scope.download = function(htmlString) {

      var latexString = latexParser.html2latex(htmlString);

      $http.post("/compile/template.tex", {"latexCode": latexString})
      .success(function(data, status, headers, config) {
        if (data.error) {
          alert(data.error);
        };
        if (typeof data.redirect === 'string') {
          pdfDelegate.$getByHandle('pdf-preview').load(data.redirect);
          //window.open(data.redirect, '_new', 'toolbar=yes, location=yes, status=yes, menubar=yes, scrollbars=yes');
        } 
      }).error(function(data, status, headers, config) {
        //TODO: Error Handling
        console.log('nope');
        //alert(data.error);
      });
    };

    $scope.submit = function() {
      $http.post("/company/document/info", {"sender": $scope.sender, "recipient": $scope.recipient})
      .success(function(data, status, headers, config)) {
        if (data.error) {
          console.log("wrong variballs!");
        }
      })
      .error(function(data, status, headers, config) {
        if (data.error) {
          console.log("wrong variballs!");
      })

    }

  //function for selecting a template
  $scope.templates = [
      {name: 'Artikel', editable: false},
      {name: 'Brief', editable: true, modaltarget: '#letter'},
      {name: 'Serienbrief', editable: true, modaltarget: '#formletter'}
    ];

  $scope.selectedTemplate = $scope.templates[0]; //Artikel is default selected

  $scope.modal = function() {  
    if ($scope.selectedTemplate.editable) {
      $($scope.selectedTemplate.modaltarget).modal('toggle');
    };
  };


}]);
{'fraction_non_alphanumeric': 0.16830019602352284, 'fraction_numerical': 0.0008401008120974517, 'mean_word_length': 3.072976054732041, 'pattern_counts': {'":': 7, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1880811', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1068, 'n_words': 225}