summary refs log tree commit diff
path: root/webclient/user
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2014-08-31 00:40:42 +0100
committerMatthew Hodgson <matthew@matrix.org>2014-08-31 00:40:42 +0100
commit1bc036a12d6877f78f1f5033603d803ac01a13d2 (patch)
tree00408a44816b73132c2aa640346733c3264eb47b /webclient/user
parentfactor out mobile css into its own file (diff)
downloadsynapse-1bc036a12d6877f78f1f5033603d803ac01a13d2.tar.xz
nasty big monolithic commit of a whole bunch of UI/UX improvements:
 - add a simple CSS template across the app for navigation & cosmetics
 - split login into login & register, and totally reskin it
 - restructure room CSS to play nicely with it
 - implement basis 1:1 chat from user pages
 - disable autofocus on iOS to improve UX
Diffstat (limited to 'webclient/user')
-rw-r--r--webclient/user/user-controller.js28
-rw-r--r--webclient/user/user.html36
2 files changed, 43 insertions, 21 deletions
diff --git a/webclient/user/user-controller.js b/webclient/user/user-controller.js
index 620230561c..b5b2d439a2 100644
--- a/webclient/user/user-controller.js
+++ b/webclient/user/user-controller.js
@@ -25,14 +25,42 @@ angular.module('UserController', ['matrixService'])
         avatar_url: undefined
     };
     
+    $scope.user_id = matrixService.config().user_id;
+    
     matrixService.getDisplayName($scope.user.id).then(
         function(response) {
             $scope.user.displayname = response.data.displayname;
         }
     ); 
+    
     matrixService.getProfilePictureUrl($scope.user.id).then(
         function(response) {
             $scope.user.avatar_url = response.data.avatar_url;
         }
     );
+    
+    $scope.messageUser = function() {    
+        
+        // FIXME: create a new room every time, for now
+        
+        matrixService.create(null, 'private').then(
+            function(response) { 
+                // This room has been created. Refresh the rooms list
+                var room_id = response.data.room_id;
+                console.log("Created room with id: "+ room_id);
+                
+                matrixService.invite(room_id, $scope.user.id).then(
+                    function() {
+                        $scope.feedback = "Invite sent successfully";
+                        $scope.$parent.goToPage("/room/" + room_id);
+                    },
+                    function(reason) {
+                        $scope.feedback = "Failure: " + JSON.stringify(reason);
+                    });
+            },
+            function(error) {
+                $scope.feedback = "Failure: " + JSON.stringify(error.data);
+            });                
+    };
+    
 }]);
\ No newline at end of file
diff --git a/webclient/user/user.html b/webclient/user/user.html
index 4c91c8a48a..3574403c87 100644
--- a/webclient/user/user.html
+++ b/webclient/user/user.html
@@ -1,31 +1,25 @@
 <div ng-controller="UserController" class="user">
-    <h1 id="logo">[matrix]</h1>
 
-    <div id="page">
     <div id="wrapper">
-        
+
+        <div id="genericHeading">
+            <img src="img/logo-small.png" width="100" height="43" alt="[matrix]"/>
+        </div>
+
+        <h1>{{ user.displayname || user.id }}</h1>
+
         <div>
-            <form>
-                <table>
-                    <tr>
-                        <td>
-                            <div class="profile-avatar">
-                                <img ng-src="{{ user.avatar_url || 'img/default-profile.jpg' }}"/>
-                            </div>
-                        </td>
-                        <td>
-                            <div id="user-ids">
-                                <div id="user-displayname">{{ user.displayname }}</div>
-                                <div>{{ user.id }}</div>                        
-                            </div>
-                        </td>
-                    </tr>
-                </table>
-            </form>
+            <div class="profile-avatar">
+                <img ng-src="{{ user.avatar_url || 'img/default-profile.png' }}"/>
+            </div>
+            <div id="user-ids">
+                <div>{{ user.id }}</div>                        
+            </div>
         </div>
 
+        <button ng-hide="user.id == user_id" ng-click="messageUser()" style="font-size: 14pt; margin-top: 40px; margin-bottom: 40px">Start chat</button>
+        <br/>
         {{ feedback }}
 
-    </div>    
     </div>
 </div>