From f7be6930cf3ed6b768deb18da5f0e80f5b01d570 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Fri, 20 Apr 2012 18:12:56 -0400 Subject: Tentative implementation of the tabs almost there! --- alias-angular/app/css/app.less | 14 +++++++++----- alias-angular/app/index.html | 14 +++++++++++++- alias-angular/app/js/controllers.js | 22 +++++++++++++++++++--- alias-angular/app/js/filters.js | 2 +- 4 files changed, 42 insertions(+), 10 deletions(-) (limited to 'alias-angular/app') diff --git a/alias-angular/app/css/app.less b/alias-angular/app/css/app.less index 5006542..e78e124 100644 --- a/alias-angular/app/css/app.less +++ b/alias-angular/app/css/app.less @@ -13,7 +13,7 @@ html, body{ width: 250px; background-color: @background-gray; border: 1px solid @border-gray; - + ul{ list-style: none; padding: 0; @@ -28,19 +28,19 @@ html, body{ padding: 1em 1em; color: #363636; .transition(0.3s); - + &:hover{ background-color: @background-gray; } - + &:first-child{ border-top: 1px solid @border-gray; } - + i{ font-size:120%; } - + .online{ color: #3D9940; } @@ -62,3 +62,7 @@ html, body{ margin-bottom:20px; } +#main{ + float: left; + margin-left: 20px; +} \ No newline at end of file diff --git a/alias-angular/app/index.html b/alias-angular/app/index.html index 2c823e3..4305308 100644 --- a/alias-angular/app/index.html +++ b/alias-angular/app/index.html @@ -32,12 +32,24 @@ +
+ +
+
Je suis {{conversation.jid}} +
+
+ diff --git a/alias-angular/app/js/controllers.js b/alias-angular/app/js/controllers.js index 1eb53e7..8768915 100644 --- a/alias-angular/app/js/controllers.js +++ b/alias-angular/app/js/controllers.js @@ -36,7 +36,7 @@ function ConnectCtl($scope, StropheSrv, $log, $rootScope) { ConnectCtl.$inject = ['$scope', 'StropheSrv', '$log', '$rootScope']; -function RosterCtl($scope, StropheSrv, $log) { +function RosterCtl($scope, StropheSrv, $log, $rootScope) { $scope.contacts = {}; $scope.get_contacts = function() { return _.toArray($scope.contacts); @@ -82,10 +82,26 @@ function RosterCtl($scope, StropheSrv, $log) { $scope.getRoster(); }); - $scope.getRoster = function () { + $scope.getRoster = function() { var query = $iq({type : 'get'}).c('query', {xmlns : Strophe.NS.ROSTER}); StropheSrv.sendIQ(query, onRoster); }; + + $scope.chatWith = function(contact) { + $rootScope.$broadcast('msgrequest', {jid: contact.jid, name:contact.name}); + }; } -RosterCtl.$inject = ['$scope','StropheSrv','$log']; +RosterCtl.$inject = ['$scope','StropheSrv','$log', '$rootScope']; + +function MsgCtl($scope, $log) { + $scope.conversations = []; + $scope.$on('msgrequest', function(event, contact){ + $log.log(contact); + if (_.indexOf($scope.conversations, contact)) { + $scope.conversations.push(contact); + } + }); +} + +MsgCtl.$inject = ['$scope','$log']; \ No newline at end of file diff --git a/alias-angular/app/js/filters.js b/alias-angular/app/js/filters.js index 6b77998..772e523 100644 --- a/alias-angular/app/js/filters.js +++ b/alias-angular/app/js/filters.js @@ -15,7 +15,7 @@ angular.module('Alias.filters', []). }); } }; - }).filter('hideoffline', function() { + }).filter('showoffline', function() { return function(contacts, checkoffline) { if(checkoffline) { return contacts; -- cgit v1.2.3-70-g09d2