<commit_before>(function() {
  'use strict';
  /* Controllers */
  angular.module('proso.feedback', ['ui.bootstrap'])

  .value('gettext', gettext)

  .directive('feedback', ['$modal', '$window', function ($modal, $window) {
    return {
      restrict: 'A',
      link: function ($scope, element, attrs) {

        $scope.feedback = {
          user_agent: $window.navigator.userAgent,
          email: '@',
          text: '',
        };

        $scope.openFeedback = function () {
          if (attrs.email) {
            $scope.feedback.email = attrs.email;
          }

          $modal.open({
            templateUrl: 'feedback_modal.html',
            controller: ModalFeedbackCtrl,
            size: 'lg',
            resolve: {
              feedback: function () {
                return $scope.feedback;
              }
            }
          });
        };

        var ModalFeedbackCtrl = ['$scope', '$modalInstance', '$http', '$cookies',
              '$location', 'feedback', 'gettext',
            function ($scope, $modalInstance, $http, $cookies, 
              $location, feedback, gettext) {

          $scope.feedback = feedback;
          $scope.alerts = [];

          $scope.send = function() {
            feedback.page = $location.absUrl();
            $http.defaults.headers.post['X-CSRFToken'] = $cookies.csrftoken;
            $http.post('/feedback/', feedback).success(function(data){
              $scope.alerts.push(data);
              $scope.sending = false;
            }).error(function(){
              $scope.alerts.push({
                type : 'danger',
                msg : gettext("V aplikaci bohužel nastala chyba."),
              });
              $scope.sending = false;
            });
            $scope.sending = true;
          };

          $scope.closeAlert = function(index) {
            $scope.alerts.splice(index, 1);
          };

          $scope.cancel = function () {
            $modalInstance.dismiss('cancel');
          };
        }];

      }<commit_msg>proso_feedback: clear text after sending to prevent resending<commit_after>(function() {
  'use strict';
  /* Controllers */
  angular.module('proso.feedback', ['ui.bootstrap'])

  .value('gettext', gettext)

  .directive('feedback', ['$modal', '$window', function ($modal, $window) {
    return {
      restrict: 'A',
      link: function ($scope, element, attrs) {

        $scope.feedback = {
          user_agent: $window.navigator.userAgent,
          email: '@',
          text: '',
        };

        $scope.openFeedback = function () {
          if (attrs.email) {
            $scope.feedback.email = attrs.email;
          }

          $modal.open({
            templateUrl: 'feedback_modal.html',
            controller: ModalFeedbackCtrl,
            size: 'lg',
            resolve: {
              feedback: function () {
                return $scope.feedback;
              }
            }
          });
        };

        var ModalFeedbackCtrl = ['$scope', '$modalInstance', '$http', '$cookies',
              '$location', 'feedback', 'gettext',
            function ($scope, $modalInstance, $http, $cookies, 
              $location, feedback, gettext) {

          $scope.feedback = feedback;
          $scope.alerts = [];

          $scope.send = function() {
            feedback.page = $location.absUrl();
            $http.defaults.headers.post['X-CSRFToken'] = $cookies.csrftoken;
            $http.post('/feedback/', feedback).success(function(data){
              $scope.alerts.push(data);
              $scope.sending = false;
              feedback.text = '';
            }).error(function(){
              $scope.alerts.push({
                type : 'danger',
                msg : gettext("V aplikaci bohužel nastala chyba."),
              });
              $scope.sending = false;
            });
            $scope.sending = true;
          };

          $scope.closeAlert = function(index) {
            $scope.alerts.splice(index, 1);
          };

          $scope.cancel = function () {
            $modalInstance.dismiss('cancel');
          };
        }];

      }
{'fraction_non_alphanumeric': 0.15026660203587008, 'fraction_numerical': 0.0004847309743092584, 'mean_word_length': 1.576154806491885, 'pattern_counts': {'":': 0, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3729869', 'n_tokens_mistral': 1169, 'n_tokens_neox': 1126, 'n_words': 202}