This commit is contained in:
Matteo Pagliazzi
2013-11-04 15:17:09 +01:00
parent f467dcb3c9
commit 774ded9fb2
3 changed files with 7 additions and 8 deletions

View File

@@ -80,14 +80,16 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
.controller('ChatCtrl', ['$scope', 'Groups', 'User', function($scope, Groups, User){
$scope._chatMessage = '';
$scope._sending = false;
$scope.postChat = function(group, message){
if (_.isEmpty(message)) return
$('.chat-btn').addClass('disabled');
console.log($scope._sending)
if (_.isEmpty(message) || $scope._sending) return;
$scope._sending = true;
group.$postChat({message:message}, function(data){
$scope._chatMessage = '';
group.chat = data.chat;
$('.chat-btn').removeClass('disabled');
$scope._chatMessage = '';
$scope._sending = false;
});
}