<commit_before>/**
 * Settings View Controller
 */
Y.namespace('LIMS.Controller');

Y.LIMS.Controller.SettingsViewController = Y.Base.create('settingsViewController', Y.View, [], {

    /**
     *  The initializer runs when a Settings View Controller instance is created, and gives
     *  us an opportunity to set up the view.
     */
    initializer: function () {
        var container = this.get('container');
        // Set panel
        this.set('panel', new Y.LIMS.View.PanelView({
            container: container,
            panelId: "settings"
        }));

        // Attach events to DOM elements from container
        this._attachEvents();
    },

    /**
     * Attaches events to DOM elements from container
     *
     * @private
     */
    _attachEvents: function () {
        // Attach click on panel's item
//        this.get('panel').get('container').delegate('click', function (event) {
//            var presence, target = event.currentTarget;
//            // Element was li
//            if (target.ancestor('li')) {
//                // Fire event
//                presence = target.getAttribute('data-status');
//                Y.fire('presenceChanged', presence);
//            }
//        }, 'li');
//
//        Y.on('presenceChanged', this._onPresenceChanged, this);
        Y.on('panelShown', this._onPanelShown, this);
        Y.on('panelHidden', this._onPanelHidden, this);
    },

    /**
     * Presence changed event
     *
     * @param presence
     * @private
     */
    _onPresenceChanged: function (presence) {
        // Update presence indicator
        this._updatePresenceIndicator(presence);
        // Todo: Send to server
        this.get('panel').hide();
    },

    /**
     * Panel shown event handler. Closes own panel if some other panel was shown.
     * Thanks to that only one panel can be open at one time.
     *
     * @param panel
     * @private
     */
    _onPanelShown: function (panel) {
        // Don't close own panel
        if (panel !== this.get('panel')) {
            this.get('panel').hide();
        }
    },

    /**
     * Panel hidden event handler. Closes own panel if some other panel was shown.
     * Thanks to that only one panel can be open at one time.
     *
     * @private
     */
    _onPanelHidden: function () {
        // Todo: send active panel ajax
    }

}, {

    // Specify attributes and static properties for your View here.
    ATTRS: {

        // Main container
        container: {
            valueFn: function () {
                return Y.one('#chatBar .chat-settings');
            }
        },

        // Panel view related to the controller
        panel: {
            value: null // to be set in initializer
        }
    }
});<commit_msg>checkbox update<commit_after>/**
 * Settings View Controller
 */
Y.namespace('LIMS.Controller');

Y.LIMS.Controller.SettingsViewController = Y.Base.create('settingsViewController', Y.View, [], {

    /**
     *  The initializer runs when a Settings View Controller instance is created, and gives
     *  us an opportunity to set up the view.
     */
    initializer: function () {
        var container = this.get('container');
        // Set panel
        this.set('panel', new Y.LIMS.View.PanelView({
            container: container,
            panelId: "settings"
        }));

        // Attach events to DOM elements from container
        this._attachEvents();
    },

    /**
     * Attaches events to DOM elements from container
     *
     * @private
     */
    _attachEvents: function () {

        // Local events
        this.get('soundCheckbox').on('click', this._onSoundCheckboxUpdated, this);

        // Remote events
        Y.on('panelShown', this._onPanelShown, this);
        Y.on('panelHidden', this._onPanelHidden, this);
    },

    /**
     * Sound checkbox changed
     *
     * @private
     */
    _onSoundCheckboxUpdated: function () {
        var isChecked = this.get('soundCheckbox').get('checked') ? true : false;
        // Todo: Send to server
        console.log('checkbox updated to: ' + isChecked);
    },

    /**
     * Panel shown event handler. Closes own panel if some other panel was shown.
     * Thanks to that only one panel can be open at one time.
     *
     * @param panel
     * @private
     */
    _onPanelShown: function (panel) {
        // Don't close own panel
        if (panel !== this.get('panel')) {
            this.get('panel').hide();
        }
    },

    /**
     * Panel hidden event handler. Closes own panel if some other panel was shown.
     * Thanks to that only one panel can be open at one time.
     *
     * @private
     */
    _onPanelHidden: function () {
        // Todo: send active panel ajax
    }

}, {

    // Specify attributes and static properties for your View here.
    ATTRS: {

        // Main container
        container: {
            valueFn: function () {
                return Y.one('#chatBar .chat-settings');
            }
        },

        // Panel view related to the controller
        panel: {
            value: null // to be set in initializer
        },

        // Sound checkbox element
        soundCheckbox: {
            valueFn: function () {
                return this.get('container').one("#playSound");
            }
        }
    }
});
{'fraction_non_alphanumeric': 0.12158855637116507, 'fraction_numerical': 0.0, 'mean_word_length': 1.7851153039832286, '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': '1215727', 'n_tokens_mistral': 1447, 'n_tokens_neox': 1411, 'n_words': 422}