<commit_before>// Includes file dependencies
define([
    "jquery",
    "backbone",
    "parse",
    "../helpers/InjectAuthData",
    "../helpers/FacebookLogin"
], function( $, Backbone, Parse, InjectAuthData, FacebookLogin ) {

    // Extends Backbone.View
    var SignupView = Backbone.View.extend( {
        events: {
            "submit form.signup-form": "signUp",
            "click #signup-with-facebook": "signUpWithFacebook"
        },

        el: "#signup",

        initialize: function() {
            _.bindAll(this, "signUp");
            this.render();
        },

        signUpWithFacebook: function(e) {
            var self = this;
            e.preventDefault();
            self.undelegateEvents();
            self.$(".signup-form .error").hide();
            this.$(".signup-form button").attr("disabled", "disabled");

            FacebookLogin().then(function () {
                location.reload();
            }, function (error) {
                console.log(JSON.stringify(error));
                self.$(".signup-form .error").html(_.escape(error.message)).show();
                self.$(".signup-form button").removeAttr("disabled");
                self.delegateEvents();
            });
        },

        signUp: function(e) {
            var self = this;
            var username = this.$("#signup-username").val();
            var password = this.$("#signup-password").val();
            e.preventDefault();
            self.undelegateEvents();
            self.$(".signup-form .error").hide();
            this.$(".signup-form button").attr("disabled", "disabled");

            Parse.User.signUp(username, password, { }, {
                success: function(user) {
                    location.reload();
                    self.undelegateEvents();
                },

                error: function(user, error) {
                    self.$(".signup-form .error").html(_.escape(error.message)).show();
                    self.$(".signup-form button").removeAttr("disabled");
                    e.delegateEvents();
                }
            });

            return false;
        },

        render: function() {
            this.template = _.template($("#signup-template").html())();
            this.$el.find("div[role='main']").html(this.template);
            this.$el.enhanceWithin();
            this.delegateEvents();
        }
    });

    // Returns the View class
    return SignupView;

} );<commit_msg>Fix delegation of events on signup<commit_after>// Includes file dependencies
define([
    "jquery",
    "backbone",
    "parse",
    "../helpers/InjectAuthData",
    "../helpers/FacebookLogin"
], function( $, Backbone, Parse, InjectAuthData, FacebookLogin ) {

    // Extends Backbone.View
    var SignupView = Backbone.View.extend( {
        events: {
            "submit form.signup-form": "signUp",
            "click #signup-with-facebook": "signUpWithFacebook"
        },

        el: "#signup",

        initialize: function() {
            _.bindAll(this, "signUp");
            this.render();
        },

        signUpWithFacebook: function(e) {
            var self = this;
            e.preventDefault();
            self.undelegateEvents();
            self.$(".signup-form .error").hide();
            this.$(".signup-form button").attr("disabled", "disabled");

            FacebookLogin().then(function () {
                location.reload();
            }, function (error) {
                console.log(JSON.stringify(error));
                self.$(".signup-form .error").html(_.escape(error.message)).show();
                self.$(".signup-form button").removeAttr("disabled");
                self.delegateEvents();
            });
        },

        signUp: function(e) {
            var self = this;
            var username = this.$("#signup-username").val();
            var password = this.$("#signup-password").val();
            e.preventDefault();
            self.undelegateEvents();
            self.$(".signup-form .error").hide();
            this.$(".signup-form button").attr("disabled", "disabled");

            Parse.User.signUp(username, password, { }, {
                success: function(user) {
                    location.reload();
                    self.undelegateEvents();
                },

                error: function(user, error) {
                    self.$(".signup-form .error").html(_.escape(error.message)).show();
                    self.$(".signup-form button").removeAttr("disabled");
                    self.delegateEvents();
                }
            });

            return false;
        },

        render: function() {
            this.template = _.template($("#signup-template").html())();
            this.$el.find("div[role='main']").html(this.template);
            this.$el.enhanceWithin();
            this.delegateEvents();
        }
    });

    // Returns the View class
    return SignupView;

} );
{'fraction_non_alphanumeric': 0.16215123331985443, 'fraction_numerical': 0.0, 'mean_word_length': 1.642628205128205, 'pattern_counts': {'":': 4, '<': 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': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '352642', 'n_tokens_mistral': 1302, 'n_tokens_neox': 1250, 'n_words': 211}