<commit_before>define(['jquery', 'backbone'], function($, Backbone){
    var View = Backbone.View.extend({
        el: '#mmx-settings',
        initialize: function(options){
            var me = this;
            me.options = options;
            me.options.eventPubSub.bind('initMMXProjectsettings', function(model){
                me.model = model;
                me.render();
            });
        },
        events: {
            'click .controls button[did="save"]': 'saveProject',
            'click .controls button[did="delete"]': 'deleteProject'
        },
        render: function(){
            this.$el.find('.view-container').html(_.template($('#MessagingProjectSettingsView').html(), {
                model : this.model
            }));
            this.$el.find('.glyphicon-info-sign').tooltip();
        },
        saveProject: function(){
            var me = this;
            var obj = utils.collect(me.$el);
            if($.trim(obj.guestUserSecret).length < 1) return alert('Guest Access Secret is a required field.');
            if($.trim(obj.appName).length < 1) return alert('App Name is a required field.');
            if(me.options.opts.col.where({appName:obj.appName}).length) return alert('The App name you specified already exists. Please choose another name.');
            me.model.save(obj, {
                success: function(){
                    me.model.set({
                        gcm : {
                            googleProjectId : obj.googleProjectId,
                            googleApiKey    : obj.googleApiKey
                        }
                    });
                    me.options.eventPubSub.trigger('renderMMXList', me.model.attributes.id);
                    Alerts.General.display({
                        title   : 'App Updated',
                        content : 'Your changes have been saved.'
                    });
                },
                error: function(e){
                    alert(e.responseText);
                }
            });
        },
        deleteProject: function(){
            var me = this;
            Alerts.Confirm.display({
                title   : 'Confirm App Deletion',
                content : 'Please verify that you wish to delete this app.'
            }, function(){
                me.model.destroy({
                    success: function(){
                        me.options.eventPubSub.trigger('renderMMXList');
                        Backbone.history.navigate('#/messaging');
                        Alerts.General.display({
                            title   : 'App Deleted',
                            content : 'Your app has been deleted.'
                        });
                    },
                    error: function(e){
                        alert(e.responseText);
                    }
                });
            });
        }
    });
    return View;
});<commit_msg>fix regression for rename<commit_after>define(['jquery', 'backbone'], function($, Backbone){
    var View = Backbone.View.extend({
        el: '#mmx-settings',
        initialize: function(options){
            var me = this;
            me.options = options;
            me.options.eventPubSub.bind('initMMXProjectsettings', function(model){
                me.model = model;
                me.render();
            });
        },
        events: {
            'click .controls button[did="save"]': 'saveProject',
            'click .controls button[did="delete"]': 'deleteProject'
        },
        render: function(){
            this.$el.find('.view-container').html(_.template($('#MessagingProjectSettingsView').html(), {
                model : this.model
            }));
            this.$el.find('.glyphicon-info-sign').tooltip();
        },
        saveProject: function(){
            var me = this;
            var obj = utils.collect(me.$el);
            if($.trim(obj.guestUserSecret).length < 1) return alert('Guest Access Secret is a required field.');
            if($.trim(obj.appName).length < 1) return alert('App Name is a required field.');
            if(me.model.attributes.appName != obj.appName && me.options.opts.col.where({appName:obj.appName}).length) return alert('The App name you specified already exists. Please choose another name.');
            me.model.save(obj, {
                success: function(){
                    me.model.set({
                        gcm : {
                            googleProjectId : obj.googleProjectId,
                            googleApiKey    : obj.googleApiKey
                        }
                    });
                    me.options.eventPubSub.trigger('renderMMXList', me.model.attributes.id);
                    Alerts.General.display({
                        title   : 'App Updated',
                        content : 'Your changes have been saved.'
                    });
                },
                error: function(e){
                    alert(e.responseText);
                }
            });
        },
        deleteProject: function(){
            var me = this;
            Alerts.Confirm.display({
                title   : 'Confirm App Deletion',
                content : 'Please verify that you wish to delete this app.'
            }, function(){
                me.model.destroy({
                    success: function(){
                        me.options.eventPubSub.trigger('renderMMXList');
                        Backbone.history.navigate('#/messaging');
                        Alerts.General.display({
                            title   : 'App Deleted',
                            content : 'Your app has been deleted.'
                        });
                    },
                    error: function(e){
                        alert(e.responseText);
                    }
                });
            });
        }
    });
    return View;
});
{'fraction_non_alphanumeric': 0.12139708375720583, 'fraction_numerical': 0.0006781959986436081, 'mean_word_length': 1.2395596051632498, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6528391', 'n_tokens_mistral': 1416, 'n_tokens_neox': 1349, 'n_words': 287}