Merge pull request #446 from ailin-nemui/show-sidebar

Properly Show and hide the sidebar on mobile layout when using Alt+g
This commit is contained in:
Tor Hveem 2014-09-05 18:17:03 +02:00
commit ec81bbafb3
2 changed files with 5 additions and 2 deletions

View file

@ -605,7 +605,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
else if (code === 13) { else if (code === 13) {
$event.preventDefault(); $event.preventDefault();
if ($scope.filteredBuffers.length > 0) { if ($scope.filteredBuffers.length > 0) {
models.setActiveBuffer($scope.filteredBuffers[0].id); $scope.setActiveBuffer($scope.filteredBuffers[0].id);
} }
$scope.search = ''; $scope.search = '';
} }

View file

@ -167,7 +167,7 @@ weechat.directive('inputBar', function() {
}); });
var activeBufferId = sortedBuffers[bufferNumber]; var activeBufferId = sortedBuffers[bufferNumber];
if (activeBufferId) { if (activeBufferId) {
models.setActiveBuffer(activeBufferId[1]); $scope.$parent.setActiveBuffer(activeBufferId[1]);
$event.preventDefault(); $event.preventDefault();
} }
} }
@ -236,6 +236,9 @@ weechat.directive('inputBar', function() {
// Alt+G -> focus on buffer filter input // Alt+G -> focus on buffer filter input
if ($event.altKey && (code === 103 || code === 71)) { if ($event.altKey && (code === 103 || code === 71)) {
$event.preventDefault(); $event.preventDefault();
if (!$scope.$parent.isSidebarVisible()) {
$scope.$parent.showSidebar();
}
document.getElementById('bufferFilter').focus(); document.getElementById('bufferFilter').focus();
return true; return true;
} }