Set focus for chat input
This commit is contained in:
parent
150744e607
commit
647e62fb0d
@ -989,9 +989,10 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
.controller('ChatMessageCtrl', [
|
.controller('ChatMessageCtrl', [
|
||||||
'$scope',
|
'$scope',
|
||||||
'$http',
|
'$http',
|
||||||
|
'$timeout',
|
||||||
'ChatMessage',
|
'ChatMessage',
|
||||||
'NewChatMessages',
|
'NewChatMessages',
|
||||||
function ($scope, $http, ChatMessage, NewChatMessages) {
|
function ($scope, $http, $timeout, ChatMessage, NewChatMessages) {
|
||||||
ChatMessage.bindAll({}, $scope, 'chatmessages');
|
ChatMessage.bindAll({}, $scope, 'chatmessages');
|
||||||
$scope.unreadMessages = NewChatMessages.length;
|
$scope.unreadMessages = NewChatMessages.length;
|
||||||
$scope.chatboxIsCollapsed = true;
|
$scope.chatboxIsCollapsed = true;
|
||||||
@ -999,6 +1000,9 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
$scope.chatboxIsCollapsed = !$scope.chatboxIsCollapsed;
|
$scope.chatboxIsCollapsed = !$scope.chatboxIsCollapsed;
|
||||||
NewChatMessages = [];
|
NewChatMessages = [];
|
||||||
$scope.unreadMessages = NewChatMessages.length;
|
$scope.unreadMessages = NewChatMessages.length;
|
||||||
|
$timeout(function () {
|
||||||
|
angular.element('#messageInput').focus();
|
||||||
|
}, 0);
|
||||||
};
|
};
|
||||||
$scope.sendMessage = function () {
|
$scope.sendMessage = function () {
|
||||||
angular.element('#messageSendButton').addClass('disabled');
|
angular.element('#messageSendButton').addClass('disabled');
|
||||||
@ -1011,6 +1015,9 @@ angular.module('OpenSlidesApp.core.site', [
|
|||||||
$scope.newMessage = '';
|
$scope.newMessage = '';
|
||||||
angular.element('#messageSendButton').removeClass('disabled');
|
angular.element('#messageSendButton').removeClass('disabled');
|
||||||
angular.element('#messageInput').removeAttr('disabled');
|
angular.element('#messageInput').removeAttr('disabled');
|
||||||
|
$timeout(function () {
|
||||||
|
angular.element('#messageInput').focus();
|
||||||
|
}, 0);
|
||||||
})
|
})
|
||||||
.error(function () {
|
.error(function () {
|
||||||
angular.element('#messageSendButton').removeClass('disabled');
|
angular.element('#messageSendButton').removeClass('disabled');
|
||||||
|
Loading…
Reference in New Issue
Block a user