diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index 8f0f2db7de..eaeac053ad 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -238,6 +238,7 @@ define(['taskbar'], function(taskbar) { return { push: composer.push, - load: composer.load + load: composer.load, + minimize: composer.minimize }; }); \ No newline at end of file diff --git a/public/src/modules/taskbar.js b/public/src/modules/taskbar.js index cc5ddad874..a53f1fab64 100644 --- a/public/src/modules/taskbar.js +++ b/public/src/modules/taskbar.js @@ -16,15 +16,20 @@ define(function() { // Posts bar events $(taskbar.taskbar).on('click', 'li', function() { - var module = this.getAttribute('data-module'), + var _btn = this, + module = this.getAttribute('data-module'), uuid = this.getAttribute('data-uuid'); require([module], function(module) { - module.load(uuid); + if (_btn.className.indexOf('active') === -1) { + module.load(uuid); - // Highlight the button - $(taskbar.tasklist).removeClass('active'); - this.className += ' active'; + // Highlight the button + $(taskbar.tasklist).removeClass('active'); + _btn.className += ' active'; + } else { + module.minimize(uuid); + } }); }); @@ -54,6 +59,7 @@ define(function() { ''; btnEl.setAttribute('data-module', module); btnEl.setAttribute('data-uuid', uuid); + btnEl.className = 'active'; taskbar.tasklist.appendChild(btnEl); taskbar.update();