From 687a2bd96555f07af8924633e050cf11c30a1e98 Mon Sep 17 00:00:00 2001 From: Evan Theurer Date: Fri, 4 Jul 2014 13:11:07 +0200 Subject: [PATCH] List contacts in contacts manager. --- src/styles/components/_contactsmanager.scss | 25 +++++--- static/js/directives/contactsmanager.js | 52 ++++++++++++++++ static/js/directives/directives.js | 6 +- static/js/services/contactdata.js | 9 ++- static/partials/contactsmanager.html | 68 +++------------------ static/partials/settings.html | 14 +++-- 6 files changed, 93 insertions(+), 81 deletions(-) create mode 100644 static/js/directives/contactsmanager.js diff --git a/src/styles/components/_contactsmanager.scss b/src/styles/components/_contactsmanager.scss index 8f25a07d..9dad7999 100644 --- a/src/styles/components/_contactsmanager.scss +++ b/src/styles/components/_contactsmanager.scss @@ -45,6 +45,22 @@ .contactsUploadPicBtn { margin-top: 7px; } + .buddyPicture { + position: relative; + width: 46px; + height: 46px; + background: $actioncolor1; + border-radius: 2px; + margin: 0 auto; + &:after { + content: "\f007"; + color: $actioncolor2; + font-family: fontAwesome; + font-size: 3em; + position: relative; + top: -6px; + } + } } .search { @@ -86,12 +102,3 @@ vertical-align: middle; } } - -.userAvatar { - position: relative; - width: 46px; - height: 46px; - background: grey; - border-radius: 2px; - margin: 0 auto; -} diff --git a/static/js/directives/contactsmanager.js b/static/js/directives/contactsmanager.js new file mode 100644 index 00000000..de23ce75 --- /dev/null +++ b/static/js/directives/contactsmanager.js @@ -0,0 +1,52 @@ +/* + * Spreed WebRTC. + * Copyright (C) 2013-2014 struktur AG + * + * This file is part of Spreed WebRTC. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ +define(['jquery', 'underscore', 'text!partials/contactsmanager.html'], function($, _, templateContactsManager) { + + return [function() { + + var contactsManagerController = ['$scope', '$modalInstance', 'contactData', function($scope, $modalInstance, contactData) { + $scope.contacts = contactData.getAllContacts(); + $scope.close = function() { + $modalInstance.close('Close'); + }; + }]; + + var controller = ['$scope', '$modal', function($scope, $modal) { + $scope.contactsManager = function() { + $modal.open({ + template: templateContactsManager, + controller: contactsManagerController, + windowClass: 'contactsManager' + }); + }; + }]; + + var link = function($scope, $element) {}; + + return { + scope: true, + restrict: 'E', + controller: controller, + link: link + }; + }]; + +}); diff --git a/static/js/directives/directives.js b/static/js/directives/directives.js index 9b4f2ff4..9bdecc63 100644 --- a/static/js/directives/directives.js +++ b/static/js/directives/directives.js @@ -36,7 +36,8 @@ define([ 'directives/roombar', 'directives/socialshare', 'directives/page', - 'directives/contactrequest'], function(_, onEnter, onEscape, statusMessage, buddyList, buddyPicture, settings, chat, audioVideo, usability, audioLevel, fileInfo, screenshare, roomBar, socialShare, page, contactRequest) { + 'directives/contactrequest', + 'directives/contactsmanager'], function(_, onEnter, onEscape, statusMessage, buddyList, buddyPicture, settings, chat, audioVideo, usability, audioLevel, fileInfo, screenshare, roomBar, socialShare, page, contactRequest, contactsManager) { var directives = { onEnter: onEnter, @@ -54,7 +55,8 @@ define([ roomBar: roomBar, socialShare: socialShare, page: page, - contactRequest: contactRequest + contactRequest: contactRequest, + contactsManager: contactsManager }; var initialize = function(angModule) { diff --git a/static/js/services/contactdata.js b/static/js/services/contactdata.js index 15b06022..c4bb0249 100644 --- a/static/js/services/contactdata.js +++ b/static/js/services/contactdata.js @@ -63,7 +63,7 @@ define(['underscore', 'jquery'], function(underscore, $) { var userid = data.Userid; var id; if (users.hasOwnProperty(userid)) { - id = users[userid] + id = users[userid]; } else { id = String(count++); users[userid] = id; @@ -88,12 +88,15 @@ define(['underscore', 'jquery'], function(underscore, $) { }, getById: function(id) { if (id.indexOf("contact-") === 0) { - id = id.substr(8) + id = id.substr(8); } if (contacts.hasOwnProperty(id)) { return contacts[id]; } - return null + return null; + }, + getAllContacts: function() { + return contacts; } }; diff --git a/static/partials/contactsmanager.html b/static/partials/contactsmanager.html index ca99dc07..8484b141 100644 --- a/static/partials/contactsmanager.html +++ b/static/partials/contactsmanager.html @@ -1,5 +1,5 @@