<commit_before>var Backbone = require('backbone');
var SettingsStore = require('../settingsStore');
var JQuerySnippet = require('../jQuerySnippet');

var SettingsView = Backbone.View.extend({

    template: require('../templates/settings.hbs'),

    events: {
        'click .submit': 'submit',
        'click .cancel': 'cancel',
        'keyup [name=client-id]': 'onClientIdInput'
    },

    initialize: function(options) {
        this.settingsModel = options.settingsModel;
        this.model = this.settingsModel.clone();

        this.listenTo(this.model, 'change:clientId', function(model, clientId) {
            this.$('.jquery-snippet').html(JQuerySnippet.generate(clientId));
        });

        this.listenTo(this.settingsModel, 'change', function(model) {
            this.model.set({
                clientId: model.get('clientId'),
                channel: model.get('channel')
            });
        });
    },

    render: function() {
        this.$el.html(this.template(this.model.toJSON()));

        this.$modal = this.$('.modal');

        return this;
    },

    show: function() {
        this.$modal.modal('show');
    },

    hide: function() {
        this.$modal.modal('hide');
    },

    onClientIdInput: function(e) {
        this.model.set('clientId', $(e.currentTarget).val());<commit_msg>Fix for settings bug<commit_after>var _ = require('lodash');
var Backbone = require('backbone');
var SettingsStore = require('../settingsStore');
var JQuerySnippet = require('../jQuerySnippet');

var SettingsView = Backbone.View.extend({

    template: require('../templates/settings.hbs'),

    events: {
        'click .submit': 'submit',
        'click .cancel': 'cancel',
        'keyup [name=client-id]': 'onClientIdInput'
    },

    initialize: function(options) {
        this.settingsModel = options.settingsModel;
        this.model = new Backbone.Model(_.clone(this.settingsModel.attributes));

        this.listenTo(this.model, 'change:clientId', function(model, clientId) {
            this.$('.jquery-snippet').html(JQuerySnippet.generate(clientId));
        });

        this.listenTo(this.settingsModel, 'change', function(model) {
            this.model.set({
                clientId: model.get('clientId'),
                channel: model.get('channel')
            });
        });
    },

    render: function() {
        this.$el.html(this.template(this.model.toJSON()));

        this.$modal = this.$('.modal');

        return this;
    },

    show: function() {
        this.$modal.modal('show');
    },

    hide: function() {
        this.$modal.modal('hide');
    },

    onClientIdInput: function(e) {
        this.model.set('clientId', $(e.currentTarget).val());
{'fraction_non_alphanumeric': 0.1715758468335788, 'fraction_numerical': 0.0, 'mean_word_length': 2.523994811932555, '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': '5366906', 'n_tokens_mistral': 799, 'n_tokens_neox': 771, 'n_words': 125}