diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2012-04-21 17:38:19 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2012-04-21 17:38:19 -0400 |
| commit | a7459f66525f4b1016146824506b016b718def1b (patch) | |
| tree | 676a33c0eb89156bb7df0792b5907d3d5b92639b /alias-angular/app/js/controllers.js | |
| parent | f7be6930cf3ed6b768deb18da5f0e80f5b01d570 (diff) | |
| download | alias-a7459f66525f4b1016146824506b016b718def1b.tar.gz | |
Tabs finally working!
Diffstat (limited to 'alias-angular/app/js/controllers.js')
| -rw-r--r-- | alias-angular/app/js/controllers.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/alias-angular/app/js/controllers.js b/alias-angular/app/js/controllers.js index 8768915..3d88dcc 100644 --- a/alias-angular/app/js/controllers.js +++ b/alias-angular/app/js/controllers.js @@ -88,7 +88,7 @@ function RosterCtl($scope, StropheSrv, $log, $rootScope) { }; $scope.chatWith = function(contact) { - $rootScope.$broadcast('msgrequest', {jid: contact.jid, name:contact.name}); + $rootScope.$broadcast('msgrequest', contact.name||contact.jid); }; } @@ -96,12 +96,24 @@ RosterCtl.$inject = ['$scope','StropheSrv','$log', '$rootScope']; function MsgCtl($scope, $log) { $scope.conversations = []; - $scope.$on('msgrequest', function(event, contact){ + $scope.activeConversation = ''; + $scope.$on('msgrequest', function(event, contact) { $log.log(contact); - if (_.indexOf($scope.conversations, contact)) { + if (_.indexOf($scope.conversations, contact)==-1) { $scope.conversations.push(contact); + $scope.activeConversation = contact; } }); + $scope.isActive = function(conversation) { + return ($scope.activeConversation == conversation) ? 'active' : ''; + }; + $scope.delete = function(conversation) { + $scope.conversations.splice(_.indexOf($scope.conversations, conversation),1); + }; + $scope.activate = function(conversation) { + $log.log(conversation+' was clicked'); + $scope.activeConversation = conversation; + }; } MsgCtl.$inject = ['$scope','$log'];
\ No newline at end of file |
