<commit_before>// Category View
// =============

// Includes file dependencies
define([
	"jquery",
	"backbone",
], function( $, Backbone ) {

    // Extends Backbone.View
    var View = Backbone.View.extend({

        // The View Constructor
        initialize: function (options) {
            _.bindAll(this, "remove", "update_value", "save_clicked");

            this.redirectRemove = options.redirectRemove || "#characters?all";
            this.redirectRemove = _.template(this.redirectRemove);
            this.redirectSave = options.redirectSave || "#character?<%= self.model.id %>";
            this.redirectSave = _.template(this.redirectSave);
        },

        events: {
            "click .cancel": "cancel",
            "change": "update_value",
            "click .save": "save_clicked"
        },

        cancel: function(a, b, c) {
            var self = this;
            $.mobile.loading("show");
            window.location.hash = self.redirectRemove({"self": self});

            return false;
        },

        update_value: function(a, b, c) {
            var self = this;
            var v = this.$(a.target).val();
            this.model.set("name", v);
        },

        save_clicked: function(a, b, c) {
            var self = this;
            var v = self.$el.find('input[name="characterName"]').val();
            self.model.save({name: v, owner: Parse.User.current(), change_count: 0}).then(function() {
                window.location.hash = self.redirectSave({"self": self});
            }, function(error) {
                console.log("Failed to save a character", error);
            })
            return false;
        },

        // Renders all of the Category models on the UI
        render: function() {
<commit_msg>Accept enter on character creation screen<commit_after>// Category View
// =============

// Includes file dependencies
define([
	"jquery",
	"backbone",
], function( $, Backbone ) {

    // Extends Backbone.View
    var View = Backbone.View.extend({

        // The View Constructor
        initialize: function (options) {
            _.bindAll(this, "remove", "update_value", "save_clicked");

            this.redirectRemove = options.redirectRemove || "#characters?all";
            this.redirectRemove = _.template(this.redirectRemove);
            this.redirectSave = options.redirectSave || "#character?<%= self.model.id %>";
            this.redirectSave = _.template(this.redirectSave);
        },

        events: {
            "click .cancel": "cancel",
            "change": "update_value",
            "click .save": "save_clicked",
            "submit": "save_clicked"
        },

        cancel: function(a, b, c) {
            var self = this;
            $.mobile.loading("show");
            window.location.hash = self.redirectRemove({"self": self});

            return false;
        },

        update_value: function(a, b, c) {
            var self = this;
            var v = this.$(a.target).val();
            this.model.set("name", v);
        },

        save_clicked: function(a, b, c) {
            var self = this;
            var v = self.$el.find('input[name="characterName"]').val();
            self.model.save({name: v, owner: Parse.User.current(), change_count: 0}).then(function() {
                window.location.hash = self.redirectSave({"self": self});
            }, function(error) {
                console.log("Failed to save a character", error);
            })
            return false;
        },

        // Renders all of the Category models on the UI
        render: function() {

{'fraction_non_alphanumeric': 0.15119510839355196, 'fraction_numerical': 0.0005558643690939411, 'mean_word_length': 1.9024193548387096, 'pattern_counts': {'":': 11, '<': 5, '<?xml version=': 0, '>': 5, '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': '2756922', 'n_tokens_mistral': 989, 'n_tokens_neox': 962, 'n_words': 227}