diff --git a/src/js/util/keyboard.js b/src/js/util/keyboard.js index cbe2d279..9217977f 100644 --- a/src/js/util/keyboard.js +++ b/src/js/util/keyboard.js @@ -30,11 +30,18 @@ KeyboardListener.prototype.listen = function() { } this.listening = true; Main.getEventBaton().stealBaton('docKeydown', this.keydown, this); + Main.getEventBaton().stealBaton('onCloseButtonClick', this.onCloseButtonClick, this); + }; KeyboardListener.prototype.mute = function() { this.listening = false; Main.getEventBaton().releaseBaton('docKeydown', this.keydown, this); + Main.getEventBaton().releaseBaton('onCloseButtonClick', this.onCloseButtonClick, this); +}; + +KeyboardListener.prototype.onCloseButtonClick = function(e) { + this.fireEvent('esc', e); }; KeyboardListener.prototype.keydown = function(e) { @@ -59,4 +66,3 @@ KeyboardListener.prototype.passEventBack = function(e) { exports.KeyboardListener = KeyboardListener; exports.mapKeycodeToKey = mapKeycodeToKey; - diff --git a/src/js/views/gitDemonstrationView.js b/src/js/views/gitDemonstrationView.js index d7198ad3..8d942f27 100644 --- a/src/js/views/gitDemonstrationView.js +++ b/src/js/views/gitDemonstrationView.js @@ -60,6 +60,7 @@ var GitDemonstrationView = ContainedBase.extend({ this.navEvents = Object.assign({}, Backbone.Events); this.navEvents.on('positive', this.positive, this); this.navEvents.on('negative', this.negative, this); + this.navEvents.on('exit', this.exit, this); this.navEvents.on('onResetButtonClick', this.onResetButtonClick, this); this.keyboardListener = new KeyboardListener({ events: this.navEvents, @@ -79,9 +80,14 @@ var GitDemonstrationView = ContainedBase.extend({ } }, + exit: function() { + alert('exittt'); + }, + receiveMetaNav: function(navView, metaContainerView) { var _this = this; navView.navEvents.on('positive', this.positive, this); + navView.navEvents.on('exit', this.exit, this); this.metaContainerView = metaContainerView; }, diff --git a/src/js/views/index.js b/src/js/views/index.js index ccebfffe..dd7b3cf1 100644 --- a/src/js/views/index.js +++ b/src/js/views/index.js @@ -314,7 +314,8 @@ var ModalTerminal = ContainedBase.extend({ className: 'modalTerminal box flex1', template: _.template($('#terminal-window-template').html()), events: { - 'click div.inside': 'onClick' + 'click div.inside': 'onClick', + 'click div.controls div.close': 'onCloseButtonClick' }, initialize: function(options) { @@ -333,6 +334,10 @@ var ModalTerminal = ContainedBase.extend({ this.$('.modal-title').text(title); }, + onCloseButtonClick: function() { + Main.getEventBaton().trigger('onCloseButtonClick'); + }, + onClick: function() { this.navEvents.trigger('click'); }, diff --git a/src/style/main.css b/src/style/main.css index c2602fc9..18a35ab7 100644 --- a/src/style/main.css +++ b/src/style/main.css @@ -480,6 +480,10 @@ div.ui-draggable div.controls div.box.flex1 div { cursor: pointer; } +div.modalTerminal div.close { + cursor: pointer !important; +} + div.controls div.box.flex1 div.close { background-color: #fb625f; }