<commit_before>App.Controllers.Deployment = can.Control.extend({
    init: function() {
        var self = this;

        this.options.flags = App.Models.Deployment.flags;
        this.renderContainer();

        this.getDeployments().done(function() {
            self.renderOptions();
            self.renderDeployments();
        });
    },

    'app.focus': function() {

    },

    'save.pane': function() {
        this.save();
    },

    save: function() {

    },

    renderContainer: function() {
        this.element.html(can.view('//app/core/views/deployment.ejs', this.options));

        this.elements = {};
        this.elements.options = this.element.find('div.options');
        this.elements.deployments = this.element.find('div.deployments');
    },

    renderDeployments: function() {
        this.elements.deployments.html(can.view('//app/core/views/deployment_deployments.ejs', this.options));
    },

    renderOptions: function() {
        this.elements.options.html(can.view('//app/core/views/deployment_options.ejs', this.options));
    },

    getDeployments: function() {
        var self = this;

        return $.Deferred(function(obj) {
            if (!self.options.deployment) {
                App.Models.Deployment.findAll().done(function(deployments) {
                    self.options.deployments = deployments;
                    obj.resolve();
                });
            } else {
                obj.resolve();
            }
        });
    },

    'div.options button click': function(el, ev) {
        var action = el.attr('data-action'),
            enabled = !el.hasClass('btn-success');

        ev.preventDefault();
        el.toggleClass('btn-success btn-warning');
        App.Models.Deployment.setFlag(action, enabled);
        this.renderDeployments();
        this.renderOptions();
    },

    'div.options input.version-input keyup': function(el, ev) {
        App.Models.Deployment.setFlag('v', el.val());
        this.renderDeployments();
    }
});<commit_msg>#SW Added saving functionality for the deployment pane<commit_after>App.Controllers.Deployment = can.Control.extend({
    init: function() {
        var self = this;

        this.load();
        this.renderContainer();

        this.getDeployments().done(function() {
            self.renderOptions();
            self.renderDeployments();
        });
    },

    'app.focus': function() {

    },

    'save.pane': function() {
        this.save();
    },

    save: function() {
        localStorage.setItem('frog_controller_deployment', JSON.stringify(this.options.flags));
    },

    load: function() {
        var storage = localStorage.getItem('frog_controller_deployment');

        this.options.flags = App.Models.Deployment.flags = storage ? JSON.parse(storage) : App.Models.Deployment.flags;
    },

    renderContainer: function() {
        this.element.html(can.view('//app/core/views/deployment.ejs', this.options));

        this.elements = {};
        this.elements.options = this.element.find('div.options');
        this.elements.deployments = this.element.find('div.deployments');
    },

    renderDeployments: function() {
        this.elements.deployments.html(can.view('//app/core/views/deployment_deployments.ejs', this.options));
    },

    renderOptions: function() {
        this.elements.options.html(can.view('//app/core/views/deployment_options.ejs', this.options));
    },

    getDeployments: function() {
        var self = this;

        return $.Deferred(function(obj) {
            if (!self.options.deployment) {
                App.Models.Deployment.findAll().done(function(deployments) {
                    self.options.deployments = deployments;
                    obj.resolve();
                });
            } else {
                obj.resolve();
            }
        });
    },

    'div.options button click': function(el, ev) {
        var action = el.attr('data-action'),
            enabled = !el.hasClass('btn-success');

        ev.preventDefault();
        el.toggleClass('btn-success btn-warning');
        App.Models.Deployment.setFlag(action, enabled);
        this.renderDeployments();
        this.renderOptions();
        this.save();
    },

    'div.options input.version-input keyup': function(el, ev) {
        App.Models.Deployment.setFlag('v', el.val());
        this.renderDeployments();
        this.save();
    }
});
{'fraction_non_alphanumeric': 0.15211970074812967, 'fraction_numerical': 0.0, 'mean_word_length': 2.1741007194244606, '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': '4033259', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1241, 'n_words': 174}