summary refs log tree commit diff
path: root/webclient/rooms
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-08-14 18:40:20 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-08-14 18:40:20 +0200
commite6c62d5d7f45234ee574595eeb5ab8b7df41a1ed (patch)
treeb6e70c7311d68b3f537b2e9479f25564bfef76e6 /webclient/rooms
parentCreate a temporary upload service server side (by hacking demos/webserver.py)... (diff)
downloadsynapse-e6c62d5d7f45234ee574595eeb5ab8b7df41a1ed.tar.xz
We can now upload avatar image somewhere
Diffstat (limited to 'webclient/rooms')
-rw-r--r--webclient/rooms/rooms-controller.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/webclient/rooms/rooms-controller.js b/webclient/rooms/rooms-controller.js
index d0924f5887..2ce14e1d49 100644
--- a/webclient/rooms/rooms-controller.js
+++ b/webclient/rooms/rooms-controller.js
@@ -16,9 +16,9 @@ limitations under the License.
 
 'use strict';
 
-angular.module('RoomsController', ['matrixService', 'mFileInput'])
-.controller('RoomsController', ['$scope', '$location', 'matrixService',
-                               function($scope, $location, matrixService) {
+angular.module('RoomsController', ['matrixService', 'mFileInput', 'mFileUpload'])
+.controller('RoomsController', ['$scope', '$location', 'matrixService', 'mFileUpload',
+                               function($scope, $location, matrixService, mFileUpload) {
                                    
     $scope.rooms = [];
     $scope.public_rooms = [];
@@ -167,7 +167,16 @@ angular.module('RoomsController', ['matrixService', 'mFileInput'])
 
     $scope.$watch("newProfileInfo.avatarFile", function(newValue, oldValue) {
         if ($scope.newProfileInfo.avatarFile) {
-            //@TODO: Upload this HTML5 image file to somewhere
+            console.log("Uploading new avatar file...");
+            mFileUpload.uploadFile($scope.newProfileInfo.avatarFile).then(
+                function(url) {
+                    $scope.newProfileInfo.avatar = url;
+                    $scope.setAvatar($scope.newProfileInfo.avatar);
+                },
+                function(error) {
+                    $scope.feedback = "Can't upload image";
+                } 
+            );
         }
     });