<commit_before>/*global define*/
define([
    'underscore',
    'app',
    'marionette',
    'helpers/uri',
    'collections/configs',
    'models/config',
    'apps/settings/show/showView',
    'fileSaver'
], function (_, App, Marionette, URI, Configs, Config, View, saveAs) {
    'use strict';

    var Show = App.module('AppSettings.Show');

    /**
     * Settings controller
     */
    Show.Controller = Marionette.Controller.extend({
        initialize: function () {
            _.bindAll(this, 'show');

            this.configs = new Configs();
            this.configs.fetch();

            // Events
            this.configs.on('changeSetting', this.save, this);
            this.configs.on('create:profile', this.createProfile, this);
            this.configs.on('remove:profile', this.removeProfile, this);
        },

        // Show settings form in modal window
        // ---------------------------------
        show : function (args) {
            var view = new View({
                collection : this.configs,
                args: args
            });
            App.modal.show(view);

            view.on('redirect', this.redirect, this);
            view.on('import', this.importSettings, this);
            view.on('export', this.exportSettings, this);
        },

        // Create new profile
        // -------------------
        createProfile: function (profile) {
            this.configs.createProfile(profile);
            App.configs.fetch();
        },

        // Create new profile
        // -------------------
        removeProfile: function (profile) {
            this.configs.removeProfile(profile);
        },

        // Export all settings<commit_msg>Confirm: Profile remove<commit_after>/*global define*/
define([
    'underscore',
    'app',
    'marionette',
    'helpers/uri',
    'collections/configs',
    'models/config',
    'apps/settings/show/showView',
    'fileSaver'
], function (_, App, Marionette, URI, Configs, Config, View, saveAs) {
    'use strict';

    var Show = App.module('AppSettings.Show');

    /**
     * Settings controller
     */
    Show.Controller = Marionette.Controller.extend({
        initialize: function () {
            _.bindAll(this, 'show');

            this.configs = new Configs();
            this.configs.fetch();

            // Events
            this.configs.on('changeSetting', this.save, this);
            this.configs.on('create:profile', this.createProfile, this);
            this.configs.on('remove:profile', this.removeProfile, this);
        },

        // Show settings form in modal window
        // ---------------------------------
        show : function (args) {
            var view = new View({
                collection : this.configs,
                args: args
            });
            App.modal.show(view);

            view.on('redirect', this.redirect, this);
            view.on('import', this.importSettings, this);
            view.on('export', this.exportSettings, this);
        },

        // Create a new profile
        // -------------------
        createProfile: function (profile) {
            this.configs.createProfile(profile);
            App.configs.fetch();
        },

        // Remove a profile
        // -------------------
        removeProfile: function (profile) {
            var result = window.confirm('Are you sure that you want to delete profile ' + profile + '?');
            if (result ) {
                this.configs.removeProfile(profile);
            }
        },

        // Export all settings
{'fraction_non_alphanumeric': 0.16755543081672747, 'fraction_numerical': 0.0, 'mean_word_length': 1.5548387096774194, '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': '4926', 'n_tokens_mistral': 939, 'n_tokens_neox': 911, 'n_words': 198}