<NME> stack.js
<BEF> /* eslint no-console: ["error", { allow: ["error"] }] */
/**
 * Stack-related functionality.
 *
 * @mixin
 * @namespace Bolt.stack
 *
 * @param {Object} bolt - The Bolt module.
 * @param {Object} $ - jQuery.
 */
(function (bolt, $) {
    'use strict';

    /**
     * Bolt.stack mixin container.
     *
     * @private
     * @type {Object}
     */
    var stack = {};

    /**
     * Initializes the mixin.
     *
     * @static
     * @function init
     * @memberof Bolt.stack
     */
    stack.init = function () {
        // Initialize add-to-stack button.
        $('a[data-bolt-addtostack]').each(function () {
            $(this).on('click', function (event) {
                var button = $(event.currentTarget),
                    file = button.data('bolt-addtostack');

                event.preventDefault();
                stack.addToStack(file, button);
            });
        });
    };

    /**
     * Add a file to the stack.
     *
     * @static
     * @function addToStack
     * @memberof Bolt.stack
     *
     * @param {string} filename - The name of the file to add
     * @param {object} element - The object that calls this function
     */
    stack.addToStack = function (filename, element) {
        $.post(bolt.conf('stackAddUrl'), {
            filename: filename,
        })
            .done(function (data) {
                // If added via a button on the page, disable the button, as visual feedback.
                if (element) {
                    $(element).addClass('disabled');
                }

                $(':bolt-buicStack').buicStack('prepend', data.panel, data.removed);

                // Move to better spot? rarila?
                if (data.removed) {
                    $('.select-from-stack [data-file]').each(function () {
                        if ($(this).data('file').fullPath === data.removed) {
                            $(this).remove();
                        }
                    });
                }
                // Prepend item to stacks (if type filter exists, only if it matches)
                $('.select-from-stack').each(function () {
                    var type = $(this).data('type');
                    if (!type || data.type === type) {
                        $(this).prepend(data.list);
                    }
                });
            })
            .fail(function () {
                console.error('Failed to add file to stack');
            });
    };

    // Apply mixin container
    bolt.stack = stack;

})(Bolt || {}, jQuery);
     * @param {string} folderUrl - The URL command string to change the folder
     */
    stack.changeFolder = function (key, folderUrl) {
        $('#selectModal-' + key + ' .modal-content').load(folderUrl);
    };

    // Apply mixin container

<MSG> Fix select from server not reacting anymore when content was reloaded
<DFF> @@ -161,7 +161,9 @@
      * @param {string} folderUrl - The URL command string to change the folder
      */
     stack.changeFolder = function (key, folderUrl) {
-        $('#selectModal-' + key + ' .modal-content').load(folderUrl);
+        $('#selectModal-' + key + ' .modal-content').load(folderUrl, function() {
+            bolt.actions.init();
+        });
     };
 
     // Apply mixin container

{'commit': "diff --git a/app/src/js/modules/stack.js b/app/src/js/modules/stack.js\nindex f929320e8..573bcba21 100644\n--- a/app/src/js/modules/stack.js\n+++ b/app/src/js/modules/stack.js\n@@ -161,7 +161,9 @@\n      * @param {string} folderUrl - The URL command string to change the folder\n      */\n     stack.changeFolder = function (key, folderUrl) {\n-        $('#selectModal-' + key + ' .modal-content').load(folderUrl);\n+        $('#selectModal-' + key + ' .modal-content').load(folderUrl, function() {\n+            bolt.actions.init();\n+        });\n     };\n \n     // Apply mixin container\n", 'commit_subject': 'Fix select from server not reacting anymore when content was reloaded', 'repo_name': 'bolt/bolt', 'committer': {'name': 'rarila', 'email': 'b257af45fbc9f52d0e728490f2c2da9e4f66647e@gmx.net', 'time_sec': '1426897011', 'tz_offset': '60', 'date': {'seconds': '1426897011'}}, 'commit_tree': '175a73ea0520274eb9435dfe9df19cd6b900f90d', 'commit_message': 'Fix select from server not reacting anymore when content was reloaded', 'language_name': 'Shell', 'license': 'mit', 'hunks': "@@ -161,7 +161,9 @@\n      * @param {string} folderUrl - The URL command string to change the folder\n      */\n     stack.changeFolder = function (key, folderUrl) {\n-        $('#selectModal-' + key + ' .modal-content').load(folderUrl);\n+        $('#selectModal-' + key + ' .modal-content').load(folderUrl, function() {\n+            bolt.actions.init();\n+        });\n     };\n \n     // Apply mixin container\n", 'addition_count': 3, 'deletion_count': 1, 'src_file': 'a/app/src/js/modules/stack.js', 'tgt_file': 'b/app/src/js/modules/stack.js', 'file_extension': '.js', 'before_file': '/* eslint no-console: ["error", { allow: ["error"] }] */\n/**\n * Stack-related functionality.\n *\n * @mixin\n * @namespace Bolt.stack\n *\n * @param {Object} bolt - The Bolt module.\n * @param {Object} $ - jQuery.\n */\n(function (bolt, $) {\n    \'use strict\';\n\n    /**\n     * Bolt.stack mixin container.\n     *\n     * @private\n     * @type {Object}\n     */\n    var stack = {};\n\n    /**\n     * Initializes the mixin.\n     *\n     * @static\n     * @function init\n     * @memberof Bolt.stack\n     */\n    stack.init = function () {\n        // Initialize add-to-stack button.\n        $(\'a[data-bolt-addtostack]\').each(function () {\n            $(this).on(\'click\', function (event) {\n                var button = $(event.currentTarget),\n                    file = button.data(\'bolt-addtostack\');\n\n                event.preventDefault();\n                stack.addToStack(file, button);\n            });\n        });\n    };\n\n    /**\n     * Add a file to the stack.\n     *\n     * @static\n     * @function addToStack\n     * @memberof Bolt.stack\n     *\n     * @param {string} filename - The name of the file to add\n     * @param {object} element - The object that calls this function\n     */\n    stack.addToStack = function (filename, element) {\n        $.post(bolt.conf(\'stackAddUrl\'), {\n            filename: filename,\n        })\n            .done(function (data) {\n                // If added via a button on the page, disable the button, as visual feedback.\n                if (element) {\n                    $(element).addClass(\'disabled\');\n                }\n\n                $(\':bolt-buicStack\').buicStack(\'prepend\', data.panel, data.removed);\n\n                // Move to better spot? rarila?\n                if (data.removed) {\n                    $(\'.select-from-stack [data-file]\').each(function () {\n                        if ($(this).data(\'file\').fullPath === data.removed) {\n                            $(this).remove();\n                        }\n                    });\n                }\n                // Prepend item to stacks (if type filter exists, only if it matches)\n                $(\'.select-from-stack\').each(function () {\n                    var type = $(this).data(\'type\');\n                    if (!type || data.type === type) {\n                        $(this).prepend(data.list);\n                    }\n                });\n            })\n            .fail(function () {\n                console.error(\'Failed to add file to stack\');\n            });\n    };\n\n    // Apply mixin container\n    bolt.stack = stack;\n\n})(Bolt || {}, jQuery);\n     * @param {string} folderUrl - The URL command string to change the folder\n     */\n    stack.changeFolder = function (key, folderUrl) {\n        $(\'#selectModal-\' + key + \' .modal-content\').load(folderUrl);\n    };\n\n    // Apply mixin container\n', 'message': 'Fix select from server not reacting anymore when content was reloaded', 'author_name': 'rarila', 'lang': 'js'}