Explorar o código

added profile picture on profile page

Akira Laine %!s(int64=9) %!d(string=hai) anos
pai
achega
fb0fe77fca
Modificáronse 3 ficheiros con 19 adicións e 2 borrados
  1. 8 0
      app/client/app.css
  2. 10 2
      app/client/client.js
  3. 1 0
      app/client/templates/profile.html

+ 8 - 0
app/client/app.css

@@ -1403,6 +1403,14 @@ nav form input[type="image"]{
     margin-right: 5px;
     margin-right: 5px;
     float: left;
     float: left;
 }
 }
+.profile-img{
+    width: 100px;
+    height: 100px;
+    margin: 0 auto;
+}
+.profile-img .avatar-initials{
+    line-height: 100px !important;
+}
 #doorbell-email{
 #doorbell-email{
     color: black;
     color: black;
 }
 }

+ 10 - 2
app/client/client.js

@@ -96,7 +96,7 @@ Template.settings.events({
 });
 });
 
 
 Template.profile.helpers({
 Template.profile.helpers({
-    username: function() {
+    "username": function() {
         return Session.get("username")
         return Session.get("username")
     },
     },
     "first_joined": function() {
     "first_joined": function() {
@@ -137,7 +137,15 @@ Template.profile.helpers({
             })
             })
         });
         });
         return dislikedArr;
         return dislikedArr;
-    }
+    },
+    initials: function() {
+        var user = Meteor.user();
+        if (user !== undefined) {
+            return user.profile.username[0].toUpperCase();
+        } else {
+            return "";
+        }
+    },
 });
 });
 
 
 Template.profile.onCreated(function() {
 Template.profile.onCreated(function() {

+ 1 - 0
app/client/templates/profile.html

@@ -4,6 +4,7 @@
       {{> header}}
       {{> header}}
       <div class="row">
       <div class="row">
         {{#if loaded}}
         {{#if loaded}}
+            {{> avatar userId=userId shape="circle" class="profile-img" initials=initials}}
             <h1 id="profile-name">{{username}}</h1>
             <h1 id="profile-name">{{username}}</h1>
 
 
             <div class="col-md-4">
             <div class="col-md-4">