From 647e62fb0ddf617b436e2d55331c1bd55b97bff3 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Sat, 20 Feb 2016 15:39:08 +0100 Subject: [PATCH] Set focus for chat input --- openslides/core/static/js/core/site.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openslides/core/static/js/core/site.js b/openslides/core/static/js/core/site.js index b06b2cb0a..0c2ac44c5 100644 --- a/openslides/core/static/js/core/site.js +++ b/openslides/core/static/js/core/site.js @@ -989,9 +989,10 @@ angular.module('OpenSlidesApp.core.site', [ .controller('ChatMessageCtrl', [ '$scope', '$http', + '$timeout', 'ChatMessage', 'NewChatMessages', - function ($scope, $http, ChatMessage, NewChatMessages) { + function ($scope, $http, $timeout, ChatMessage, NewChatMessages) { ChatMessage.bindAll({}, $scope, 'chatmessages'); $scope.unreadMessages = NewChatMessages.length; $scope.chatboxIsCollapsed = true; @@ -999,6 +1000,9 @@ angular.module('OpenSlidesApp.core.site', [ $scope.chatboxIsCollapsed = !$scope.chatboxIsCollapsed; NewChatMessages = []; $scope.unreadMessages = NewChatMessages.length; + $timeout(function () { + angular.element('#messageInput').focus(); + }, 0); }; $scope.sendMessage = function () { angular.element('#messageSendButton').addClass('disabled'); @@ -1011,6 +1015,9 @@ angular.module('OpenSlidesApp.core.site', [ $scope.newMessage = ''; angular.element('#messageSendButton').removeClass('disabled'); angular.element('#messageInput').removeAttr('disabled'); + $timeout(function () { + angular.element('#messageInput').focus(); + }, 0); }) .error(function () { angular.element('#messageSendButton').removeClass('disabled');