<commit_before>define(["underscore","views/form","models/Contact"],function(_,Form,Contact){

    var ContactForm = Form.extend({

        settings : {
            invalidEmailErrorMessage : "Please provide a valid email address so we can get back to you",
            invalidMessageErrorMessage : "Please write something",
            failedToSendErrorMessage : "Something went wrong. Your message was not sent. Please try again later."
        },

        __validationRules : function(){
            return {
                email: {
                    required: true,
                    email: true
                },
                message: {
                    required : true
                }
            };
        },

        __validationMessages : function(){
            return {
                email : {
                    required : this.settings.invalidEmailErrorMessage,
                    email : this.settings.invalidEmailErrorMessage
                },
                message : {
                    required : this.settings.invalidMessageErrorMessage
                }
            };
        },

        __submit : function(form){

            this.__showProgress();

            this.trigger("submitting");

            Contact.sendMessage(
                this.$("input[name='email']").val(),
                this.$("textarea[name='message']").val(),
                _.bind(function(){
                    this.$(".success-message").removeClass("hidden");
                    this.__restoreForm();
                },this),
                _.bind(function(){
                    this.trigger("invalid",null,this.settings.failedToSendErrorMessage);
                    this.__restoreForm();
                },this)<commit_msg>clean contact form after submit<commit_after>define(["underscore","views/form","models/Contact"],function(_,Form,Contact){

    var ContactForm = Form.extend({

        settings : {
            invalidEmailErrorMessage : "Please provide a valid email address so we can get back to you",
            invalidMessageErrorMessage : "Please write something",
            failedToSendErrorMessage : "Something went wrong. Your message was not sent. Please try again later."
        },

        __validationRules : function(){
            return {
                email: {
                    required: true,
                    email: true
                },
                message: {
                    required : true
                }
            };
        },

        __validationMessages : function(){
            return {
                email : {
                    required : this.settings.invalidEmailErrorMessage,
                    email : this.settings.invalidEmailErrorMessage
                },
                message : {
                    required : this.settings.invalidMessageErrorMessage
                }
            };
        },

        __submit : function(form){

            this.__showProgress();

            this.trigger("submitting");

            Contact.sendMessage(
                this.$("input[name='email']").val(),
                this.$("textarea[name='message']").val(),
                _.bind(function(){
                    this.$(".success-message").removeClass("hidden");
                    this.__restoreForm();
                    var cleanContactForm = document.forms[0];
                    cleanContactForm.elements["email"].value = "";
                    cleanContactForm.elements["message"].value = "";
                },this),
                _.bind(function(){
                    this.trigger("invalid",null,this.settings.failedToSendErrorMessage);
                    this.__restoreForm();
                },this)
{'fraction_non_alphanumeric': 0.1061257388500806, 'fraction_numerical': 0.00026867275658248256, 'mean_word_length': 1.374362244897959, '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': '5809085', 'n_tokens_mistral': 831, 'n_tokens_neox': 758, 'n_words': 154}