From 191d7514d82fe5cd4721399a1b8395481a27d2a5 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Fri, 2 Jan 2015 16:55:26 +0100 Subject: [PATCH] Added esc handling --- app/js/controllers.js | 5 +++++ app/js/directives.js | 3 +++ 2 files changed, 8 insertions(+) diff --git a/app/js/controllers.js b/app/js/controllers.js index f433add2..3b5823a8 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -336,6 +336,10 @@ angular.module('myApp.controllers', ['myApp.i18n']) } }); + $scope.$on('esc_no_more', function () { + $location.url('/im'); + }); + $scope.isLoggedIn = true; $scope.isEmpty = {}; @@ -1145,6 +1149,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) } function showEmptyHistory () { + safeReplaceObject($scope.historyPeer, {}); safeReplaceObject($scope.state, {notSelected: true}); peerHistory = false; hasMore = false; diff --git a/app/js/directives.js b/app/js/directives.js index a9b28c07..5d72d66a 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -459,6 +459,9 @@ angular.module('myApp.directives', ['myApp.filters']) else if (searchField.value) { $(searchClear).trigger('click'); } + else { + $scope.$emit('esc_no_more'); + } return cancelEvent(e); }