overleaf/services/web/public/coffee/ide/chat/controllers/ChatController.coffee

21 lines
505 B
CoffeeScript
Raw Normal View History

2014-07-02 10:56:09 -04:00
define [
"base"
2014-07-15 13:25:12 -04:00
"ide/chat/services/chatMessages"
2014-07-02 10:56:09 -04:00
], (App) ->
2014-07-15 13:25:12 -04:00
App.controller "ChatController", ($scope, chatMessages, @ide, $location) ->
$scope.chat = chatMessages.state
$scope.$watchCollection "chat.messages", (messages) ->
if messages?
2014-07-15 13:25:12 -04:00
$scope.$emit "messages:updated"
$scope.sendMessage = ->
2014-07-15 13:25:12 -04:00
chatMessages
.sendMessage $scope.newMessageContent
.then () ->
$scope.newMessageContent = ""
$scope.loadMoreMessages = ->
chatMessages.loadMoreMessages()