aboutsummaryrefslogtreecommitdiffstats
path: root/alias-angular/app/js
diff options
context:
space:
mode:
Diffstat (limited to 'alias-angular/app/js')
-rw-r--r--alias-angular/app/js/controllers.js18
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