<commit_before>define('app/views/key_list', [
     'app/views/mistscreen',
    'text!app/templates/key_list.html',
    'ember'
    ],
    /**
     * Key List View
     *
     * @returns Class
     */
    function(MistScreen, key_list_html) {
        return MistScreen.extend({

            template: Ember.Handlebars.compile(key_list_html),

            selectedKey: null,

            selectedKeysObserver: function() {
                var that = this;
                var selectedKeysCount = 0;
                Mist.keysController.keys.some(function(key) {
                    if (key.selected) {
                        if(++selectedKeysCount == 2) {
                            $('#keys-footer a').addClass('ui-disabled');
                            that.selectedKey = null;
                            return true;
                        }
                        that.selectedKey = key;
                    }
                });
                if (selectedKeysCount == 0) {
                    $('#keys-footer').fadeOut(200);
                } else if (selectedKeysCount == 1) {
                    $('#keys-footer').fadeIn(200);
                    $('#keys-footer a').removeClass('ui-disabled');
                }
            }.observes('Mist.keysController.keys.@each.selected'),

            createClicked: function() {
                $("#create-key-dialog").popup("open");
            },

            selectClicked: function() {
                $('#select-keys-dialog').popup('open');
            },

            selectionModeClicked: function(mode) {
                Mist.keysController.keys.forEach(function(key) {
                    key.set('selected', mode);
                });
                Ember.run.next(function() {
                    $("input[type='checkbox']").checkboxradio("refresh");
                });
                $('#select-keys-dialog').popup('close');
            },

            deleteClicked: function() {
                var keyName = this.selectedKey.name;
                Mist.confirmationController.set('title', 'Delete key');
                Mist.confirmationController.set('text', 'Are you sure you want to delete "' + keyName +'" ?');
                Mist.confirmationController.set('callback', function() {
                    Mist.keysController.deleteKey(keyName);
                });
                Mist.confirmationController.show();
            },

            setDefaultClicked: function() {
                Mist.keysController.setDefaultKey(this.selectedKey.name);
            }
        });
    }
);<commit_msg>Implementing actions directly on views/controllers/models is now depricated. Start changing actions in keys list view<commit_after>define('app/views/key_list', [
     'app/views/mistscreen',
    'text!app/templates/key_list.html',
    'ember'
    ],
    /**
     * Key List View
     *
     * @returns Class
     */
    function(MistScreen, key_list_html) {
        return MistScreen.extend({

            template: Ember.Handlebars.compile(key_list_html),

            selectedKey: null,

            selectedKeysObserver: function() {
                var that = this;
                var selectedKeysCount = 0;
                Mist.keysController.keys.some(function(key) {
                    if (key.selected) {
                        if(++selectedKeysCount == 2) {
                            $('#keys-footer a').addClass('ui-disabled');
                            that.selectedKey = null;
                            return true;
                        }
                        that.selectedKey = key;
                    }
                });
                if (selectedKeysCount == 0) {
                    $('#keys-footer').fadeOut(200);
                } else if (selectedKeysCount == 1) {
                    $('#keys-footer').fadeIn(200);
                    $('#keys-footer a').removeClass('ui-disabled');
                }
            }.observes('Mist.keysController.keys.@each.selected'),

            actions: {

                createClicked: function() {
                    $("#create-key-dialog").popup("open");
                },

                selectClicked: function() {
                    $('#select-keys-dialog').popup('open');
                },

                selectionModeClicked: function(mode) {
                    Mist.keysController.keys.forEach(function(key) {
                        key.set('selected', mode);
                    });
                    Ember.run.next(function() {
                        $("input[type='checkbox']").checkboxradio("refresh");
                    });
                    $('#select-keys-dialog').popup('close');
                },

                deleteClicked: function() {
                    var keyName = this.selectedKey.name;
                    Mist.confirmationController.set('title', 'Delete key');
                    Mist.confirmationController.set('text', 'Are you sure you want to delete "' + keyName +'" ?');
                    Mist.confirmationController.set('callback', function() {
                        Mist.keysController.deleteKey(keyName);
                    });
                    Mist.confirmationController.show();
                },

                setDefaultClicked: function() {
                    Mist.keysController.setDefaultKey(this.selectedKey.name);
                }
            }
        });
    }
);
{'fraction_non_alphanumeric': 0.12759643916913946, 'fraction_numerical': 0.00370919881305638, 'mean_word_length': 1.3007679180887373, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3860014', 'n_tokens_mistral': 1353, 'n_tokens_neox': 1272, 'n_words': 191}